View Full Version : Problem with crontab
biljanapp
5th September 2008, 12:57
I have sh script which generate doxygen html files.
#!/bin/sh
cd /myfile
doxygen ./Doxyfile
I try to run script with crontab
10 10 * * * sh /scripts/doxy.sh
The problem is that on my virtual machine run just fine but on my server don't run.
If I try to execute the script manually it run.
I don't figure out what is wrong???
Regards Biljana
falko
6th September 2008, 12:34
Please use the full path to doxygen in your script (e.g. /usr/bin/doxygen instead of just doxygen).
Alternatively, you could add a PATH variable to your script, e.g.
#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
cd /myfile
doxygen ./Doxyfile
ralic
6th September 2008, 18:46
The problem is that on my virtual machine run just fine but on my server don't run.
Check your log files for hints on any errors that might be happening and check your mailbox also as cron often emails the user when jobs fail. Also, do you use the same OS on both? There are some differences.
e.g. My /etc/crontab (on ubuntu) has a username field:# m h dom mon dow user command
So your crontab entry:10 10 * * * sh /scripts/doxy.shprobably wouldn't work on ubuntu unless you had a user "sh" and /scripts/doxy.sh was +x
Further to what Falko mentioned previously, it would be good practice to include the full path to the shell in the crontab entry:
/bin/sh /scripts/doxy.shThat way you'll be sure that the script is executed by the correct sh.
biljanapp
7th September 2008, 19:34
Thanks for sugestion to check my log file.
I notice some warnings there.
I fix the warnings and now it's work just fine.
Thank you
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.