dnf install python3 python3-pip
python -V
pip3 -V
pip3 install --upgrade pip
pip3 install supervisor
バージョン確認
supervisord --version
設定ファイルの作成
mkdir /etc/supervisor/
mkdir /etc/supervisor/conf.d
/etc/supervisor/supervisor.sock
vi /etc/supervisor/supervisord.conf
supervisord.conf
[supervisord]
# nodaemon=true
[supervisorctl]
[inet_http_server]
# port = 127.0.0.1:9001
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[include]
files = /etc/supervisor/conf.d/*.conf
[unix_http_server]
file=/etc/supervisor/supervisor.sock
chmod=0755
[supervisord]
# フォアグラウンドで実行(バックグラウンドだとコンテナが終了するため)
# nodaemon=true
[program:nginx]
command=nginx -g "daemon off;"
autostart=true
autorestart=true
[program:nextjs]
command=node /app/.next/standalone/server.js
autostart=true
autorestart=true
supervisord -c /etc/supervisor/supervisord.conf
supervisorctl status
supervisorctl shutdown
https://askubuntu.com/questions/911994/supervisorctl-3-3-1-http-localhost9001-refused-connection
supervisorctl help
こちらの方法で確認するのがとても分かりやすくて良いです ! https://chariosan.com/2019/11/10/supervisor4_al2/
1. hello.sh の用意
cd /home/myuser
vi hello.sh
#!/bin/bash
while :; do
echo "Hello, world!"
sleep 1
done
chmod +x hello.sh
1. hello.sh を監視する設定ファイルを作成
vi /etc/supervisor/conf.d/hello.conf
[program:hello]
command=/home/kusanagi/MYDOMAIN.COM/sh/hello.sh
process_name=%(program_name)s_%(process_num)02d
autostart=true
autorestart=true
user=kusanagi
numprocs=1
redirect_stderr=true
stdout_logfile=/tmp/hello.log