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

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