Supervisor非root启动进程

使用apt安装的supervisor,默认是以root账户重启进程的,会导致生成的日志都在root用户组,非root用户下的程序无法读写这些日志导致程序无法运行

使用pip install supervisor 安装方式能使用非root账户启动进程

以下方法是pip安装方式下如何配置开机启动项

创建文件

sudo vim /usr/lib/systemd/system/supervisord.service

 查找supervisord路径

(base) ➜  ~ whereis supervisord                                 
supervisord: /home/用户名/anaconda3/bin/supervisord

  

[Unit]
Description=Supervisor daemon

[Service]
Type=forking
ExecStart=supervisord路径 -c supervisord.conf路径
ExecStop=supervisord路径 shutdown
ExecReload=supervisord路径 reload
killMode=process
Restart=on-failure
RestartSec=42s
User=用户名
[Install]
WantedBy=multi-user.target

 设置开机启动

sudo systemctl enable supervisord     

  

原文地址:https://www.cnblogs.com/john-xiong/p/14075246.html