Run a program with supervisor on Ubuntu and Debian VPS
The gist show how to run a program with supervisor on Ubuntu and Debian VPS
[program:pybot]
command=/home/user/pybot/venv/bin/python bot.py
directory=/home/user/pybot/
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/py_bot.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=50
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
loglevel=warn
Then run commands below after every change to supervisor files:
supervisorctl reread
supervisorctl update
We can start, stop and restart a program with the associated commands followed by the program name:
supervisorctl start pybot
supervisorctl stop pybot
supervisorctl restart pybot