• Welcome to LiuJason's Blog!

Linux使用Shell+crontab定时检查进程,若不存在则运行|守护进程Bash

Linux笔记 Jason 5 years ago (2019-01-20) 1012 Views 0 Comments

rclone挂载之后,在rclone盘中做FTP和sharecloud,如果rclone挂掉了会非常麻烦,于是设置了这样一个crontab来守护rclone进程,不罗嗦了上代码:

function check(){
  count=`ps -ef |grep $1 |grep -v "grep" |wc -l`
  if [ 0 == $count ];then
  nohup rclone mount onedrive:/ /storage --allow-other &
  fi
}

check rclone

 


This article is under CC BY-NC-SA 4.0 license.
Please quote the original link:https://www.liujason.com/article/172.html
Like (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址