Linux下怎么守护进程

2013 年 11 月 19 日
 iZr
比如程序在/root/x

用 /root/x start

启动后程序就到 top 里去了,

然后我我想让这个 x 一直运行 ,死掉了在启动.

怎么办?

谢谢
6532 次点击
所在节点    Linux
26 条回复
roricon
2013 年 11 月 19 日
supervisor。谁用谁知道。
roricon
2013 年 11 月 19 日
http://supervisord.org/
补个地址……
iZr
2013 年 11 月 19 日
@roricon supervisor 好像只能守护前台的进程吧?比如 ss.但是supervisor守护 nginx 就不行吧
roricon
2013 年 11 月 19 日
chilaoqi
2013 年 11 月 19 日
用 runnit
timothyye
2013 年 11 月 19 日
chilaoqi
2013 年 11 月 19 日
sandtears
2013 年 11 月 19 日
一种可行的办法就是写个crontab排程,定期检测一下
ms2008
2013 年 11 月 19 日
@iZr nginx nodaemon 就可以了
mozillazg
2013 年 11 月 19 日
最简单的办法就是使用 crontab 定期检测是否存在相关进程,不存在则执行启动命令/脚本

获取使用 supervisor
I1l
2013 年 11 月 19 日
upstart就行了
LetFoxRun
2013 年 11 月 19 日
crontab
hui314
2013 年 11 月 19 日
usoluyun
2013 年 11 月 19 日
supervisor +1
zjhui
2013 年 11 月 19 日
简单粗暴,whie true死循环一直跑。
ericls
2013 年 11 月 19 日
supervisord 非常好用
L42y
2013 年 11 月 19 日
systemd 最高
wuxqing
2013 年 11 月 19 日
在用monit
xierch
2013 年 11 月 20 日
debian系的话,upstart 也挺方便的
http://upstart.ubuntu.com/cookbook/#respawn
terry
2013 年 11 月 20 日
monit 可以监控自动重启

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://study.congcong.us/t/89811

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX