Cron job not running
-
Hi Everyone,
I have installed the cron package and I have also tried with "crontab -e" but both methods fail for the following script:
#!/bin/sh DATErand=`date +%s` cp /tmp/faxspin.avi /tmp/faxspin-$DATErand.avi wput /tmp/faxspin-$DATErand.avi ftp://anonymous:pass@ftp.com/public/incoming/ rm -rf /tmp/faxspin-$DATErand.avi
File privilges: -rwxr-xr-x 1 root wheel 229 Sep 13 22:06 /usr/bin/wput.sh
There is no indication that the script file is run as there is no faxspin-$DATErand.avi is created. This works just fine if I run this script from shell.
Please advise.
Thanks,
-
On the wput line, use the full path to wput. That may be the only issue.
-
This is exactly what I have in the cron:
-
-
-
-
- root /usr/bin/wput.sh
-
-
-
And here is the change I made per your suggestion to no avail:
#!/bin/sh
DATErand=date +%s
cp /tmp/faxspin.avi /tmp/faxspin-$DATErand.avi
/usr/local/bin/wput /tmp/faxspin-$DATErand.avi ftp://anonymous:pass@ftp.com/public/incoming/
rm -rf /tmp/faxspin-$DATErand.aviHow can I see the logs as to what really happens? if logs are not turned on for cron, how can I turn it on.
Thanks
-
-
The logs for cron are not configured in syslog – however, if you enable remote syslog, and tell it to send "everything" it will also forward the logs for cron to a remote box where you can see them.
In a cron script, always make sure you use the full path to every command - even date, cp, rm, etc. That or at the start of the script, set your own PATH variable to include the directories where the binaries you need lie.