xor_bytes 发表于 2013-2-7 12:26:50

debian定时任务系统

cron是一个linux下的定时执行工具,可以在无需人工干预的情况下运行作业。
查看一下cron是否有自动启动
# cd /etc/rc2.d
# ls -al
lrwxrwxrwx1 root root   14 Apr 13 19:29 S89cron -> ../init.d/cron
如果有上面一项就说明cron有自动启动。
如果没有,则可以自己做一个link
ls -sf /init.d/cron S89cron

编辑/etc/crontab文件配置cron
下面是我的机了下的crontab
# cat /etc/crontab
# m h dom mon dow usercommand
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

所以每天要执行的任务放在 /etc/cron.daily/下,每周要执行的任务放在/etc/cron.weekly下,每月要执行的任务放在/etc/cron.monthly下。
页: [1]
查看完整版本: debian定时任务系统