码迷,mamicode.com
首页 > 系统相关 > 详细

linux 程序运行监控

时间:2015-12-10 19:05:57      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:

一 . 使用supervise

  是daemon-tools 的一个功能,系统的守护进程.在进程挂掉的时候可以自动重启.

二   安装

  wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
  tar zxvf *.tar.gz && cd daemon/package

    这里代码修改下代码,sed -i ‘s/extern int errno;/#include <errno.h>/1‘ ./src/error.h,

      install ,  type supervise , 安装完毕

  写出一个脚本之后,创建文件夹,文件夹内写run脚本,退出到上一级,在supervise 这个文件夹. run 就开始运行了.

三  附加

  写一个自动杀死某进程的脚本

1 #!/bin/bash
2 ps axf | grep $1 | grep -v |awk {print $2} | while read line 
3 do
4     
5     kill -9 ${line}
6     echo ${line}
7 done

调用 ./test xx {xx} 就是程序中的$1

四  用createrepo 创建一个自己的repo .这样你就可以随时收集自己喜欢的软件源了.

  yum -y install createrepo && makir -p /root/yumupload

  createrepo /root/yumtest/

  vi /etc/yum.repos.d/

  创建一个新的repo ,

  baseurl=file:///root/yumtest/

  yum clean all

  yum makecache

  
搞定.

 

 

    

 

linux 程序运行监控

标签:

原文地址:http://www.cnblogs.com/liuyuxing/p/5036710.html

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