centos7安裝配置supervisor守護進程

yum install Supervisor 
supervisord -c /etc/supervisord.conf

進入 cd /etc 目錄 找到supervisord.conf 配置文件 和 supervisord.d 文件夾,使用vim編輯supervisord.conf文件,它會加載supervisord.d文件夾中的全部.ini配置文件php

[program:DeployLinux]   #DeployLinux  爲程序的名稱
command=dotnet DeployLinux.dll #須要執行的命令
directory=/home/publish #命令執行的目錄
environment=ASPNETCORE__ENVIRONMENT=Production #環境變量   註釋符不用# 環境變量能夠省略
user=root #用戶
stopsignal=INT 
autostart=true #是否自啓動
autorestart=true #是否自動重啓
startsecs=3 #自動重啓時間間隔(s)
stderr_logfile=/var/log/ossoffical.err.log #錯誤日誌文件
stdout_logfile=/var/log/ossoffical.out.log #輸出日誌文件
配置實例
[program:future_price_depth_new.py]
command=python /bot/mkr/future_price_depth_new.py 注意intergal_util.py用python3啓動 [command=python3 /bot/mkr/future_price_depth_new.py]
directory=/bot/mkr/
user=root
stopsignal=INT
autostart=true
autorestart=true
startsecs=3
stderr_logfile=/bot/log/future_price_depth_new.err.log
stdout_logfile=/bot/log/future_price_depth_new.out.log

supervisorctl reload  //從新加載配置文件python

經常使用命令介紹web

supervisorctl 是 supervisord的命令行客戶端工具
supervisorctl status:查看全部進程的狀態
supervisorctl stop es:中止es
supervisorctl start es:啓動es
supervisorctl restart es: 重啓es
supervisorctl update :配置文件修改後可使用該命令加載新的配置
supervisorctl reload: 從新啓動配置中的全部程序

    或者vim

supervisord   -c supervisor.conf                     經過配置文件啓動supervisor
supervisorctl -c supervisor.conf status              查看狀態
supervisorctl -c supervisor.conf reload              從新載入配置文件
supervisorctl -c supervisor.conf start [all]|[x]     啓動全部/指定的程序進程
supervisorctl -c supervisor.conf stop [all]|[x]      關閉全部/指定的程序進程 
ps -ef|grep python
root       572     1  0 Dec15 ?        00:00:17 /usr/bin/python2 -Es /usr/sbin/tuned -l -P
root      7704  7686  1 16:13 pts/2    00:03:06 /root/anaconda3/bin/python3 future_price_depth_new_2.py
root      7726  7708  1 16:13 pts/3    00:03:08 /root/anaconda3/bin/python3 future_price_depth_new.py
root      8291     1  1 Dec06 ?        04:10:59 python future_price_depth_new.py
root      8298     1  1 Dec06 ?        04:06:28 python future_price_depth_new_2.py
root     16948     1  0 19:46 ?        00:00:00 /usr/bin/python /usr/bin/supervisord -c /etc/supervisord.conf
root     16949 16948  3 19:46 ?        00:00:00 python /bot/mkr/future_price_depth_new.py
root     16950 16948  7 19:46 ?        00:00:00 python /bot/mkr/timer_util.py
root     16951 16948  9 19:46 ?        00:00:01 python3 /bot/mkr/intergal_util.py
root     16952 16948  9 19:46 ?        00:00:01 python /bot/mkr/mkr.py
root     16953 16948  1 19:46 ?        00:00:00 python /bot/mkr/webs_util.py
root     16963 16952  8 19:46 ?        00:00:00 /root/anaconda3/bin/python /bot/mkr/mkr.py
root     16977 10161  0 19:46 pts/0    00:00:00 grep --color=auto python
root     19717     1  0 Dec15 ?        00:04:00 python -u w267bot.py -273195517 605518038:AAGy5TAoc4DfeW3Ol3ezEryqYEJGgq7mbF0
相關文章
相關標籤/搜索