- Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.
- Start like any other program at boot time.
- If process gets killed, it brings up the program on its own.
Tried these in CentOS (RedHat)
How to install
yum -y install supervisor
How to Start/Restart/Stop/Status
systemctl start supervisord
systemctl enable supervisord
systemctl status supervisord
/etc/supervisord.d/test.ini
[group:test]
programs=test1, test2
[program:test1]
command=python -u test1.py
directory=/opt/site
stdout_logfile=/tmp/prabhath.log
redirect_stderr=true
[program:test2]
command=python -u test2.py
directory=/opt/site
stdout_logfile=/tmp/prabhath.log
redirect_stderr=true
How to restart Group
supervisorctl restart test:*
/opt/site/test1.py
import time
while True:
print('inside Test1')
time.sleep(1)
/opt/site/test2.py
import time
while True:
print('inside Test2')
time.sleep(2)
No comments:
Post a Comment