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?
Asked
Active
Viewed 8,940 times
3

Ben
- 3,800
- 18
- 65
- 96
1 Answers
10
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.

user9517
- 115,471
- 20
- 215
- 297