I have a shell script that writes the date to a log file when executed. When I run the script manually, the correct output gets written to the file. However, this needs to be automated, and when I run as a cron job, nothing is getting written to the file and I am confused why.
crontab:
0 * * * * tomcat /usr/bin/sh /apps/rdsreplication/snap_replication.sh
Sample Code:
#/bin/bash/
echo ---------------------------------------- >> create_snap.txt
echo Start time: >> create_snap.txt
date >> create_snap.txt
Any help would be appreciated!
pwd
does cron run things under?/usr/bin/sh
? This is an unusual location for a shell. 2. Whichcrontab
file are you using, or how are you adding this line tocron
? 3. What gets reported incron
's log file (typically somewhere in/var/log
) for this job?/bin
as a symlink to/usr/bin
nowadays, since it is no longer possible to have/usr
on a separate partition anyway.