linux定时器crontab

mac2022-06-30  32

linux定时器crontab用法:

1、基本格式 :   *  *  *  *  *  command   分 时 日 月 周 命令   第1列表示分钟1~59 每分钟用*或者 */1表示   第2列表示小时1~23(0表示0点)   第3列表示日期1~31   第4列表示月份1~12   第5列标识号星期0~6(0表示星期天)   第6列要运行的命令

2、创建定时器crontab -e,例如输入:

  30 2 1 * * /usr/bin/certbot renew >> /var/log/le-renew.log  35 2 1 * * /usr/bin/systemctl reload nginx

  如果不需要填的选项就写 * ,不能空着不然会报错的,例如:

  "/tmp/crontab.cNLTYQ":1: bad month  errors in crontab file, can't install

3、crontab -l查看系统已设置的定时器内容

4、定时器文件的位置:/var/spool/cron

转载于:https://www.cnblogs.com/waterlufei/p/7261807.html

相关资源:linux定时器crontab的使用教程
最新回复(0)