Supervisor 在ubuntu系统下添加自启动

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

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

配置以下:spa

[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,因权限问题我在用户目录里添加了配置。unix

2. 执行以下命令code

sudo systemctl daemon-reloadserver

sudo systemctl enable supervisord.serviceblog

sudo systemctl start supervisord.service进程

最后重启就能够看到,supervisor已经自启动ip

 

3.说明get

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

 

参考:

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

相关文章
相关标签/搜索