How to Install Supervisord on CentOS 7
Supervisor is a program used to monitor and control programs. It can auto startup application on server boot time, and restart if the application fails.
To install supervisors on CentOS 7, first, enable epel repository.
1 |
yum install -y epel-release |
Once EPEL repository is enabled, you can install supervisors with the yum command
1 |
yum install -y supervisor |
Enable supervisord to start on boot, run
1 |
systemctl enable supervisord |
Start supervisord
1 |
systemctl start supervisord |
To start a python application on boot time, I created file
1 |
vi /etc/supervisord.d/telegram-bot.ini |
With the following content
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
[program:telegram_bot] command=/root/bots/telegram_bot/bot.py directory=/root/bots/telegram_bot ;process_name=%(program_name)s ; process_name expr (default %(program_name)s) numprocs=1 autostart=true autorestart=true stdout_logfile=/var/log/telegram-bot.log stdout_logfile_maxbytes=1MB stdout_logfile_backups=10 stdout_capture_maxbytes=1MB stdout_events_enabled=false stderr_logfile=/var/log/telegram-bot-error.log stderr_logfile_maxbytes=1MB stderr_logfile_backups=10 stderr_capture_maxbytes=1MB stderr_events_enabled=false |
Started application with
1 |
supervisorctl reload |
See supervisord