Linux下怎么守护进程
- 0次
- 2021-07-20 04:28:37
- idczone
比如程序在/root/x
用 /root/x start
启动后程序就到 top 里去了,
然后我我想让这个 x 一直运行 ,死掉了在启动.
怎么办?
谢谢
supervisor。谁用谁知道。
http://supervisord.org/
补个地址……
supervisor 好像只能守护前台的进程吧?比如 ss.但是supervisor守护 nginx 就不行吧
http://plone.293351.n2.nabble.com/controlling-nginx-with-supervisor-td1480855.html
google一下就有的答案的问题……
用 runnit
基于Ruby的 God http://godrb.com/
基于Node.js的:
Forever https://github.com/nodejitsu/forever
PM2 https://github.com/Unitech/pm2
介绍:http://cnodejs.org/topic/51f8c15144e76d216a588fcc
https://wiki.archlinux.org/index.php/runit
一种可行的办法就是写个crontab排程,定期检测一下
nginx nodaemon 就可以了
最简单的办法就是使用 crontab 定期检测是否存在相关进程,不存在则执行启动命令/脚本
获取使用 supervisor
upstart就行了
crontab
+1
supervisor +1
简单粗暴,whie true死循环一直跑。
supervisord 非常好用
systemd 最高
在用monit
debian系的话,upstart 也挺方便的
http://upstart.ubuntu.com/cookbook/#respawn
monit 可以监控自动重启
http://www.qixing318.com/article/use-supervisord-management-process.html
安装supervisord、配置、示例,希望这篇文章能对你有用
supervise
supervisord
都可以啊,很多类似的强悍工具
找个人 守着 :)
+1, upstart可以把软件打包成service,以后直接start/stop/restart/status yourapp就行了
+1
现在centos也有了