设置很简单,但如果误入歧途,会耽误很多时间
步骤如下:
1. 以root执行:vi /etc/crontab
2. 在文件最后添加cron配置(每天凌晨四点执行,并将日志输出到/data/cron.log中)
#data backup 0 4 * * * root /bin/sh /data/backup.sh >> /data/cron.log 2<&1
3. 重启cron:service cron restart
注:如果想开启syslog记录cron日志,需要编辑/etc/rsyslog.d/50-default.conf,去掉cron前的#