Nginx定时重启

0
8

* 利用crontab定时重启nginx

/etc/init.d/cron status         #查看状态
/etc/init.d/cron start          #启动crontab服务
service cron start              #启动cron服务
/etc/init.d/cron stop           #停止crontab服务
/etc/init.d/cron reload         #重载定时任务
service cron restart            #重启cron服务
crontab -e                      # 编辑当前用户的crontab
crontab -l                      # 查看定时任务列表
  • crontab 每3分钟重启一次 */3 * * * * systemctl nginx restart
  • crontab 每3小时重启一次 00 */3 * * * systemctl nginx restart
  • crontab 每天0点重启一次 0 0 * * * systemctl nginx restart
  • crontab 每周重启一次 0 0 * * 0 systemctl nginx restart
  • crontab 每月重启一次 0 0 1 * * systemctl nginx restart
  • crontab 每年重启 一次 0 0 1 1 * systemctl nginx restart

发布回复

请输入评论!
请输入你的名字