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