centos安裝autossh supervisord

centos安裝autossh

sudo yum install wget gcc make
wget http://www.harding.motd.ca/autossh/autossh-1.4e.tgz
tar -xf autossh-1.4e.tgz
cd autossh-1.4e
./configure
make
sudo make install
mkdir /etc/supervisor
echo_supervisord_conf > /etc/supervisor/supervisord.conf

mkdir /etc/supervisor/supervisord.d/

vim /etc/supervisor/supervisord.conf

[include]
files = /usr/supervisor/supervisord.d/*.conf
[inet_http_server]
port=0.0.0.0:9001
username=user
password=1234qwer

supervisord -c /etc/supervisor/supervisord.conf

lsof -i:9001

cat > /usr/supervisor/supervisord.d/test.conf

ssh -L 1932:127.0.0.1:1932 -R 1932:127.0.0.1:1933 -NR 1922:localhost:1122 -p 1122 user@vps ssh -NfD 8389 gfw@vps -p 22

[program:autossh]
command=autossh -M 1932 -NR 1922:localhost:1122 user@vps -p 1122 ; 被監控的進程路徑
priority=1 ; 數字越高,優先級越高
numprocs=1 ; 啓動幾個進程
autostart=true ; 隨着supervisord的啓動而啓動
autorestart=true ; 自動重啓
startretries=10 ; 啓動失敗時的最多重試次數
exitcodes=0 ; 正常退出代碼
stopsignal=KILL ; 用來殺死進程的信號
stopwaitsecs=10 ; 發送SIGKILL前的等待時間
redirect_stderr=true ; 重定向stderr到stdout

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

[Unit]
Description=Process Monitoring and Control Daemon
After=rc-local.service nss-user-lookup.target
[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /usr/supervisor/supervisord.conf ;開機啓動時執行
ExecStop=/usr/bin/supervisord shutdown
ExecReload=/usr/bin/supervisord reload
killMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target

systemctl enable supervisord

systemctl is-enabled supervisord

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章