We help IT Professionals succeed at work.

cronjob doesnt work

blaadje
blaadje asked
on
I have a crontab that doesnt seem to work. It creates an empty logfile so i can see that it is triggered but the scripts arent run..

Crontab:
SHELL=/bin/sh
# m h  dom mon dow   command
33 15 * * * /home/administrator/backup/radius_dump > /home/administrator/backup/radius_dump.log
0 * * * * ntpdate ntp.xs4all.nl > /home/administrator/backup/ntp.log

/home/administrator/backup/radius_dump:
cd /home/administrator/backup/
mysqldump --opt -uroot -pX radius >/home/administrator/backup/radius_backup.sql
Comment
Watch Question

Hi!

It might be the file rights that's wrong.

Regards, Tobias

Author

Commented:
-rw-rw-rw- 1 administrator administrator  344971 2010-06-09 12:03 Configs.rar
-rw-r--r-- 1 administrator administrator     787 2010-06-09 11:08 crontab
-rw-r--r-- 1 root          root                0 2010-06-10 15:33 ntp.log
-rw-r--r-- 1 administrator administrator 5373124 2010-06-09 11:04 radius_backup.sql.gz
-rw-rw-rw- 1 administrator administrator     114 2010-06-10 14:35 radius_dump
-rw-r--r-- 1 root          root                0 2010-06-10 15:33 radius_dump.log

im running the script as root...
Try setting execute right on this file:

-rw-rw-rw- 1 administrator administrator     114 2010-06-10 14:35 radius_dump

chmod a+x radius_dump
and put this in the first line of the bash script:

#!/bin/bash

Author

Commented:
just a FYI: the logfile of the ntpdate stays empty 2

Author

Commented:
your solutions works but the logfile stays empty
Use:

2>&1

Like this:

33 15 * * * /home/administrator/backup/radius_dump >> /home/administrator/backup/radius_dump.log 2>&1

Author

Commented:
thank you so much for your help!
yw! ;)