user678070
user678070

Reputation: 1425

cron job not executing

my backup script in crontab is not getting executed, the crond log shows nothing about executing the job. I edited /etc/crontab, then restarted crond. nada. what's wrong?

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

#backup home dir w/ important scripts
00 02 * * * root /home/backup.sh

Upvotes: 0

Views: 2238

Answers (2)

Paperghost
Paperghost

Reputation: 96

# run-parts
@hourly /etc/cron.hourly
@daily /etc/cron.daily
@weekly /etc/cron.weekly
@monthly /etc/cron.monthly

#backup
@midnight /home/$username/backup.sh

if you are running this cron as root then the home would be something like /root/scripts/backup.sh

string         meaning
------         -------
@reboot        Run once, at startup.
@yearly        Run once a year, "0 0 1 1 *".
@annually      (same as @yearly)
@monthly       Run once a month, "0 0 1 * *".
@weekly        Run once a week, "0 0 * * 0".
@daily         Run once a day, "0 0 * * *".
@midnight      (same as @daily)
@hourly        Run once an hour, "0 * * * *".

Upvotes: 0

Naim Zard
Naim Zard

Reputation: 405

try replacing 00 02 * * * root /home/backup.sh by this: 00 02 * * * ./home/backup.sh

Upvotes: 0

Related Questions