码迷,mamicode.com
首页 > 其他好文 > 详细

centos7使用crontab监测服务器的运行情况

时间:2018-08-07 10:17:41      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:服务   home   code   gre   情况   文件   art   centos7   test   

  • 脚本文件:
    vim /home/lee/test.sh
    #!/bin/bash
    if [ "`pgrep test | wc -l`" == "0" ]; then
    echo "`date ‘+%F %T‘`:[test]停止运行" >> /var/log/crontab/crontab.log
    systemctl restart test
    fi
  • crontab配置:
    crontab -e
    * * * * *  .  /home/lee/test.sh
  • centos7使用crontab监测服务器的运行情况

    标签:服务   home   code   gre   情况   文件   art   centos7   test   

    原文地址:http://blog.51cto.com/12173069/2155513

    (0)
    (0)
       
    举报
    评论 一句话评论(0
    登录后才能评论!
    © 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
    迷上了代码!