linux -- 后台管理程序 supervisor

[HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED][HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED][HTML_REMOVED]记忆就像是握在手中的水,不管你握紧还是摊开都会慢慢的消失[HTML_REMOVED][HTML_REMOVED][HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED]前言[HTML_REMOVED] [HTML_REMOVED]搭建 ss 的时候发现把 putty 关闭之后就关掉了进程,发现是没有在后台运行,就找了相关的进程管理,发现 supervisor 还不错,就使用了[HTML_REMOVED] [HTML_REMOVED]查了挺多资料,整合成一份可以使用的[HTML_REMOVED] [HTML_REMOVED]supervisor 是用 Python 开发的一套通用的进程管理程序,能将一个普通的命令行进程变为后台 daemon,并监控进程状态,异常退出时能自动重启[HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED]安装[HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED][HTML_REMOVED][HTML_REMOVED]$ apt-get install supervisor [HTML_REMOVED][HTML_REMOVED]

[HTML_REMOVED]

[HTML_REMOVED] [HTML_REMOVED]生成初始配置文件[HTML_REMOVED] [HTML_REMOVED]初始的配置文件可能是已经有的,不需要再创建[HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED][HTML_REMOVED][HTML_REMOVED]$ mkdir /etc/supervisor $ echo_supervisord_conf [HTML_REMOVED] /etc/supervisor/supervisord.conf [HTML_REMOVED][HTML_REMOVED]

[HTML_REMOVED] [HTML_REMOVED]添加进程管理[HTML_REMOVED] [HTML_REMOVED]这里以 ss 为例[HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED][HTML_REMOVED][HTML_REMOVED]$ vim /etc/supervisor/supervisord.conf [HTML_REMOVED][HTML_REMOVED]

[HTML_REMOVED]

[HTML_REMOVED] [HTML_REMOVED]启动[HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED][HTML_REMOVED][HTML_REMOVED]supervisord -c /etc/supervisor/supervisord.conf [HTML_REMOVED][HTML_REMOVED]

[HTML_REMOVED] [HTML_REMOVED]管理[HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED][HTML_REMOVED][HTML_REMOVED]supervisorctl stop shadowsocks supervisorctl start shadowsocks supervisorctl restart shadowsocks [HTML_REMOVED][HTML_REMOVED]

[HTML_REMOVED] [HTML_REMOVED]错误解决[HTML_REMOVED] [HTML_REMOVED][HTML_REMOVED][HTML_REMOVED][HTML_REMOVED]$ sudo unlink /tmp/supervisor.sock [HTML_REMOVED][HTML_REMOVED]

[HTML_REMOVED]