ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux 监控进程是否存在的脚本

Linux 监控进程是否存在的脚本

原创 Linux操作系统 作者:甲骨文技术支持 时间:2017-12-26 12:42:21 0 删除 编辑

今天写了一个脚本监控beidouchaind这个进程是否存,如果存在就返回信息并写入日志文件,否则就启动

  1. #!/bin/sh
  2. ps -fe|grep beidouchaind |grep -v grep
  3. if [ $? -ne 0 ]
  4. then
  5. echo ">>>>no beidouchain,run it." `date` >> /root/beidouchain.log
  6. /usr/local/bin/beidouchaind corechain@192.xxx.1.xx:7179 -daemon
  7. else
  8. echo ">>>>beidouchain is running." `date` >> /root/beidouchain.log
  9. fi

在crontab里设置,每分钟调用一次

  1. * * * * * sh /root/monitor_beidouchain_process.sh




来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/20893244/viewspace-2149304/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
2009年获得Oracle OCM认证,ITPUB社区OCM联盟成员,熟悉Oracle,mysql,Python,Zabbix等。

注册时间:2016-12-31

  • 博文量
    143
  • 访问量
    570502