进入/lib/systemd/system目录,并创建supervisor.service文件,

supervisord 安装之后会在/lib/systemd/system 目录自动生成 supervisor.service 文件,如果没有的话,按照如下格式编辑文件

[Unit]
Description=supervisor  
After=network.target

[Service]
Type=forking  
ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf  
ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown  
ExecReload=/usr/bin/supervisorctl $OPTIONS reload  
KillMode=process  
Restart=on-failure  
RestartSec=42s

[Install]
WantedBy=multi-user.target  

运行:

chmod 766 supervisor.service  
systemctl enable supervisor.service  
systemctl daemon-reload  
Error: Another program is already listening on a port that one of our HTTP servers is configured to use.  Shut this program down first before starting supervisord.  
sudo unlink /run/supervisor.sock  

按照 @xyang0917 所讲:

Supervisor只能管理非daemon的进程,也就是说Supervisor不能管理守护进程。否则提示Exited too quickly (process log may have details)异常。例子中的Tomcat默认是以守护进程启动的,所以我们改成了catalina.sh run,以前台进程的方式运行。