您的位置:首页 > 运维架构 > Linux

CentOS中添加Crontab计划任务

2017-02-15 00:00 337 查看
摘要: Let‘s Encrypt证书认证成功后,添加进计划任务

这里记录两种方法:

###1、直接添加

# crontab -e

#secu-tcs-agent monitor, install at Sat Feb 11 00:29:09 CST 2017
* * * * * /usr/local/sa/agent/secu-tcs-agent-mon-safe.sh /usr/local/sa/agent > /dev/null 2>&1
*/1 * * * * /usr/local/qcloud/stargate/admin/start.sh > /dev/null 2>&1 &
*/20 * * * * /usr/sbin/ntpdate ntpupdate.tencentyun.com >/dev/null &
#添加到这里就可以,

例:(每周六以root用户执行一次,/root/autorenewal.sh脚本,将日志写入/var/log/autorenewal.log需要先创建该文件)

* * * * 6 root /root/autorenewal.sh >> /var/log/autorenewal.log 2>&1

###2、命令行添加

#  echo '* * * * 6 root /root/autorenewal.sh >> /var/log/autorenewal.log 2>&1' >> /etc/crontab

完成
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Linux CentOS