crontab在debian系统下的正确设置方法

VPS技术分享

crontab在debian系统下的正确设置方法

2021-02-28 19:28


                                            




核心是:* * * * * root date >> /adingshi/date/sj.txt

解释:前面的星号是代表定时的具体时间,root必填!代表执行用户名是用哪个,date是命令行,  >>代表输入到的目的地,最后的是目的地的文件路径

第一项是定时器的具体时间,请大家百度,上面的例子代表一分钟执行一次,这是必须要填写的!

第二项是,root,必填项!代表用户名!

第三项是命令行,就是执行的命令是什么?

第四项和第五项是执行后的结果输出到哪里!

 

以下是默认的配置!

SHELL=/bin/sh

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

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 )

#

* * * * * root date >> /adingshi/date/sj.txt

 


标签:
  • crontab