Forum Moderators: bakedjake

Message Too Old, No Replies

Cron job not working

         

doctormelodious

5:34 am on Jul 29, 2004 (gmt 0)

10+ Year Member



Greetings,

My ISP allows cron jobs, and I am trying to do my first one, but it's not working. I have an executable shell script called "bkp". Its path is /home/myaccount/www/bkp. Here's the script:


cd /home/myacount/www
theArchive="mydir."`date +%y%m%d`".tar"
tar cfp $theArchive mydir
gzip $theArchive
chmod 400 $theArchive.gz

The script works fine from the shell prompt, but I can't get it to run as a cron job. I created a file called "mytab" in the same directory:


13 0 * * * /home/myaccount/www/bkp

...to test it at 13 minutes past midnight, which was a couple of minutes away when I ran the test. Then I typed:


crontab mytab

Next I did a "crontab -l" to make sure it took, and it echoed back the contents of "mytab".

However, 13 minutes past midnight came and went, and the job didn't run. The .gz file did not get created. Any idea what I'm doing wrong?

Thanks!
Perry

doctormelodious

6:22 am on Jul 29, 2004 (gmt 0)

10+ Year Member



Well... it seems the only thing I was doing wrong was not giving the system enough lead time. I changed the time to a later time (about 15 minutes later), and then came back to check. The job had run.

So... nevermind!