I created a script to do something (after I reduced it just to echo "IS FINALLY WORKING" for testing purpose). If I type
#bash /var/www/html/somedir/script.sh
it works ok.
The problem is that I need a cron to access it and it doesn't work.
To set up the cron I used:
crontab -e
15 * * * * /var/www/html/somedir/script.sh
or
15 * * * * bash /var/www/html/somedir/script.sh
I see no result at all.
Also I tried to log it
15 * * * * /var/www/html/somedir/script.sh > cronscriptlog.log
The log is empty.
The os is CentOS 5.5.
Best Answer
Make sure
/var/www/html/somedir/script.sh
doesn't rely on anything outside cron's default PATH. CentOS has the default PATH set to/sbin:/bin:/usr/sbin:/usr/bin
.You may wish to create cron jobs like this:
or
to get an execution environment similar to that of your command line.