supervisord 簡介:
Supervisord 是用 Python 實現的一款的進程管理工具,supervisord 要求管理的程序是非 daemon 程序,supervisord 會幫你把它轉成 daemon 程序,因此如果用 supervisord 來管理進程,進程需要以非daemon的方式啓動。
例如:管理nginx 的話,必須在 nginx 的配置文件裏添加一行設置 daemon off 讓 nginx 以非 daemon 方式啓動。
安裝,配置過程 參考了 胡偉煌 Linux 學習筆記 非常詳細,非常感謝
https://www.bookstack.cn/read/huweihuang-linux-notes/tools-supervisor-usage.md
另外其他資料上說 在編寫 supervisord 管理nginx的配置文件(就是supervisord 通過這個配置文件來啓動nginx)上說,
nginx的啓動命令 要加上 -g ‘daemon off;’ 但是我嘗試了之後,發現這樣並不能啓動nginx, 我還是通過改變 nginx 自身的配置文件 比如:
/usr/local/nginx/conf/nginx.conf
...
daemon off;
...
events {
...
}
http {
...
}
另外 將 supervisord加入開機啓動項:
systemctl enable supervisord
參考鏈接:https://blog.csdn.net/cxu123321/article/details/104766471/