I have created a test cronjob using crontab -e that runs a script at /home/cmccabe/cron.sh . I am not sure the script doesn't run though I can call it in terminal. Thank you :).
crontab -e (run script sat at 6:10pm)?
10 18 * * 6 /home/cmccabe/cron.sh
contents of cron.sh
#!/bin/bash
echo "Is it 6:10pm?"
I can see the service is running, but the cronjob does not execute.
#!/bin/bash
echo "Is it 6:10pm?" > /home/mcccabe/somefile.txt
Try that, also when there is output from a cronjob like yours did, that writes to stdout,
output went to email - the email account for you on your linux box.
Other important point: NONE of your environment variables are available to the job run under cron.
#!/bin/bash
source /home/mccabe/.profile # or where you have the process setup code
echo "Is it 6:10pm?" > /path/to/somefile.txt
There are loads of ways to do this, above is just a simple example....
While I'm at it: quick debug of a crontab entry:
Example:
it is Friday as 22:00pm exactly so set your job for 2 minutes in the future:
create your job with crontab like:
2 22 * * * /home/cmccabe/test.sh
wait 3 minutes, check your expected output - email or whatever.
Remove the test cron entry. Wash, rinse, repeat until you have your code working AND you have it running as expected.
Also note the "6" you have in your original entry will be different in different locales. Some places the week starts with Monday, other days, Sunday. So I cannot tell what day you are looking at.
Also check out anacron - allows you to turn off the machine and have jobs run anyway, later at the first chance.