Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm setting up a crontab to auto generate our Doxygen documentation every day. I'd like to just have a single command that does this rather than creating a .sh file that does it. My question is that normally I run doxygen CONFIGFILE in the current directory that I want to generate the documentation for. I'd like to set this up on cron so it happens every morning, but since the command is run in the current directory I can't.... how can I make it so in a single cron command it knows which directory to run the command on?

share|improve this question
up vote 9 down vote accepted

You can run multiple commands on one crontab line e.g.

30 5 * * *  cd /path/to/working/directory && /path/to/doxygen CONFIGFILE

The && will only run the second command if the first completes successfully.

Note that the PATH for CRON is generally not the same as your interactive PATH so using full pathnames to commands is generally a good practice.

share|improve this answer
Perfect, I'll give it a go! – Webnet Jul 14 '11 at 13:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.