Koozali.org: home of the SME Server

Can you spot what I am doing wrong with this cron job?

Bill

Can you spot what I am doing wrong with this cron job?
« on: November 20, 2003, 11:21:24 PM »
I am trying to run mondo backup as a nightly cron job and for some reason I cannot get it to work. Works fine from the cmd prompt. Here are the script and the cron file. The cron file is loaded in /etc/cron.d with 755 permissions.

--------- cron file ------------

#+-----------------------Minute           (0-59)
#|    +-------------------Hour of Day    (0-23)
#|    |    +---------------Day of Month  (1-31)
#|    |    |    +-----------Month of Year (1-12)
#|    |    |    |    +-------Day of Week   (0=Sun,6=Sat)
#v   v   v   v   v
 09  03  *   *   *  root /root/backup >/dev/null&

------- end cron -------------

------script (/root/backup) ----------

 #!/bin/sh
 cp /mnt/storage2/MondoBackup/CurrentBackup/1.iso /mnt/storage2/MondoBackup/CurrentBackup/1.iso.yesterday
 
 mondoarchive -Oi -d /mnt/storage2/MondoBackup/CurrentBackup -E "/mnt/storage1 /mnt/storage2"  -F
 
---- end script ---------

Thanks for your help,

Bill

Stefan Braunstein

Re: Can you spot what I am doing wrong with this cron job?
« Reply #1 on: November 21, 2003, 12:09:08 AM »
Bill wrote:

>  09  03  *   *   *  root /root/backup >/dev/null&

Remove the first "root" and the "&"!

Stefan

Michiel

Re: Can you spot what I am doing wrong with this cron job?
« Reply #2 on: November 21, 2003, 01:19:18 AM »
>  cp /mnt/storage2/MondoBackup/CurrentBackup/1.iso
> /mnt/storage2/MondoBackup/CurrentBackup/1.iso.yesterday
>  
>  mondoarchive -Oi -d /mnt/storage2/MondoBackup/CurrentBackup
> -E "/mnt/storage1 /mnt/storage2"  -F

In cron jobs, allways give the full path to the application:
/path/to/mondoarchive

To check if a cronjob starts correctly, you could put the following line at the top of your script:

echo "running backup script" | mail -s date admin

This will send an e-mail with time stamp to admin if the script is being triggered.

Michiel

PS: Contrary to what Stefan wrote, you do need the 'root' reference in /etc/cron.d.