Atong介绍的这个工具,挺好用的。supervise

官方网站: https://cr.yp.to/daemontools.html

cd /data/test

cat test.c

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h> int main() {
int ix = 0;
while (1) {
printf("%d\n", ix);
sleep(1);
ix += 1;
}
return 0;
}

  cat run

#!/bin/bash
./test

  

执行命令 svstat  /data/test,结果如下:

pstree -p:

自动监控并重启服务supervise

----------------------------------------------------------------------------------------------

创建服务所在目录

mkdir test
cd test more run
#!/bin/bash
./test more test.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h> int main() {
int ix = 0;
while (1) {
printf("%d\n", ix);
sleep(1);
ix += 1;
}
return 0;
} cd ..
nohup supervise test &

  

这样就可以守护test进程了,确保test服务被kill掉后自动重启。

最新文章

  1. 增加线程异步发送消息的方法一(Thread)
  2. 问题解决——MFC SDI程序 CFormView中控件随窗口缩放
  3. 51nod 1065 最小正子段和
  4. CNN卷积神经网络在自然语言处理的应用
  5. tachyon 配置项
  6. C++箴言:理解 new-handler的行为
  7. javascript学习记录-2-18
  8. Ubuntu14.04 安装配置Opencv3.0和Python2.7
  9. windows下使用Play框架
  10. 高性能mysql 第五章 索引部分总结
  11. (整理)MySQL_REHL6.5 安装MySQL5.5
  12. spring之文件上传
  13. mongoose 基础api 图表整理
  14. debian下创建新用户useradd
  15. Oracle性能优化之HINT的用法
  16. 2-string相关函数
  17. [BAT]操作系统定时任务调用批处理忽略error继续运行的方法
  18. gradle 构建工具,与Ant Maven关系
  19. FusionMap 检测融合基因
  20. P3866 [TJOI2009]战争游戏 最小割

热门文章

  1. RSA的公钥和私钥到底哪个才是用来加密和哪个用来解密?
  2. spring mvc 表单提交 乱码
  3. 【剑指offer】面试题 15. 二进制中 1 的个数
  4. Power BI连接至Mogo Altas Connector For BI
  5. Eclipse Qt开发环境的建立
  6. centos 新增用户, 然后他在主目录添加网站403Forbbiden
  7. ProxyStrike运行bug解决办法
  8. Linux-Oracle 安装配置步骤
  9. JZYZOJ1372 [noi2002]荒岛野人 扩展欧几里得
  10. JZYZOJ 1382 光棍组织 状压dp