[vox-tech] crontab

Alex Mandel tech_dev at wildintellect.com
Sun Sep 6 17:38:24 PDT 2009


Hai Yi wrote:
> this might be too simple a question to ask, however i am doing it anyway.
> 
> i want to run a cron job to back up the dump files from my database
> tables on a weekly basis. I've never set a cron job before. So by
> following the "goolge-search" result, I did these:
> 
> I create a text file and add a line to set time, date and my script,
> name the file "cronjob.txt"
> 59 23 * * * /home/hai/Scripts/backup.sh
> 
> from CLI: crontab cronjob.txt
> confirm the job: crontab -l
> 
> then I sat tight waiting for the magic moment. Nothing happened.
> 
> I must have missed something, what is it?
> 
> I am using ubuntu 8.10, and I test the script manually, it works fine.
> 
> Thanks!
> Hai

On ubuntu boxes you'll find a folder /etc/cron.weekly
if you place a script in there is will be run weekly.

If you need to time it specifically you'll want to put your control file
that you have above into /etc/cron.d (Note this is system wide)

you also missed what day of week to execute on
59 23 * * 0
that would be sunday = 0 at the end there

Based on the method you used it should have run every night, maybe
there's a permissions error, as it would have run under your user since
you used the crontab command to set it. Try adding a log write to your
script so you can tell when it runs.
http://en.wikipedia.org/wiki/Cron

Alex


More information about the vox-tech mailing list