利用cron监视后台进程状态(二)

本文介绍了如何通过修改系统级的crontab来监视后台进程状态,具体步骤包括使用`sudo vim /etc/crontab`添加定时任务,并确保指定`root`用户执行,以确保任务有效。
摘要由CSDN通过智能技术生成

第二种方案:更改系统级的crontab

1. 命令行输入:$sudo vim /etc/crontab

最后一行添加:*  *    * * *   root    bash /home/test/wanda_img_store/backends/bin/cron_worker.sh  ,记得一定要添加user:root,否则不生效!

  1 # /etc/crontab: system-wide crontab                                                                                                
  2 # Unlike any other crontab you don't have to run the `crontab'
  3 # command to install the new version when you edit this file
  4 # and files in /etc/cron.d. These files also have username fields,
  5 # that none of the other crontabs do.
  6 
  7 SHELL=/bin/sh
  8 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  9 
 10 #m h dom mon dow user   command
 11 17 *    * * *   root    cd / &&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值