我的crontab中的备份脚本没有被执行,crond日志没有显示执行作业的任何内容。我编辑了/ etc / crontab,然后重启了crond。缥缈。怎么了?
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
答案 0 :(得分:0)
尝试用此替换00 02 * * * root /home/backup.sh
:
00 02 * * * ./home/backup.sh
答案 1 :(得分:0)
# run-parts
@hourly /etc/cron.hourly
@daily /etc/cron.daily
@weekly /etc/cron.weekly
@monthly /etc/cron.monthly
#backup
@midnight /home/$username/backup.sh
如果您以root身份运行此cron,那么home将类似于/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 * * * *".