Supervisor 在ubuntu系统下添加自启动

最近在使用frp内网穿透,以便自己的工具能在外网访问。自己内网主机有时需要重启,为了工具能正常访问,所以使用supervisor工具进行进程管理,supervisor的自启动成个很必要的需求。下面简单描述下我从stackoverflow上找到的解决方案,并配上我自己的配置。

1.在/lib/systemd/system/中添加supervisord.service文件

配置如下:

[Unit]
Description=Supervisord Service

[Service]
Restart=on-failure
RestartSec=42s
User=myuser
ExecStart=/home/myuser/.pyenv/versions/3.6.8/bin/supervisord -n -c /home/myuser/etc/supervisord.conf

[Install]

User替换成你的用户名,ExecStart 命令中supervisord的路径替换成你自己的路径 supervisord.conf同样替换成你自己的配置路径,常用路径是/etc/supervisord.conf,因权限问题我在用户目录里添加了配置。

2. 执行如下命令

sudo systemctl daemon-reload

sudo systemctl enable supervisord.service

sudo systemctl start supervisord.service

最后重启就可以看到,supervisor已经自启动

 

3.说明

本方法适用ubuntu16.04及以上版本

 

参考:

https://unix.stackexchange.com/questions/281774/ubuntu-server-16-04-cannot-get-supervisor-to-start-automatically

posted @ 2019-06-23 09:33  不懂得小白  阅读(2247)  评论(0编辑  收藏  举报