使用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     

  

相关文章:

  • 2022-01-07
  • 2022-01-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-03-09
  • 2021-06-25
  • 2022-12-23
相关资源
相似解决方案