Skip to content

Instantly share code, notes, and snippets.

@hezhao
Last active May 20, 2022 05:34
Show Gist options
  • Save hezhao/bb0bee800531b89d7be1 to your computer and use it in GitHub Desktop.
Save hezhao/bb0bee800531b89d7be1 to your computer and use it in GitHub Desktop.
Example supervisor config file /etc/supervisor/conf.d/myapp.conf
[program:myapp]
autostart = true
autorestart = true
command = python /home/pi/myapp.py
environment=HOME="/home/pi",USER="pi",SECRET_ID="secret_id",SECRET_KEY="secret_key_avoiding_%_chars"
stdout_logfile = /home/pi/stdout.log
stderr_logfile = /home/pi/stderr.log
startretries = 3
user = pi
$ sudo apt-get install supervisor
$ sudo touch /etc/supervisor/conf.d/myapp.conf
$ sudo supervisorctl reload
$ sudo supervisorctl start myapp
$ sudo supervisorctl tail myapp
$ sudo supervisorctl status
@renatoaraujoc
Copy link

Thank you for this!

@saikumar843
Copy link

I need to run flask run within "path/to/myfile/flask run"

This config file is not starting the supervisor process.

[program:stats]
directory = /home/sai/Documents/Python3release/hello_app
command = /home/sai/Documents/Python3release/hello_app/python3 -m flask run
redirect_stderr = true
stdout_logfile = /home/sai/Documents/Python3release/logs/out.log
stderr_logfile = /home/sai/Documents/Python3release/logs/error.log

"sudo supervisorctl update stats"
"sudo supervisorctl start stats"
stats (error no such file)

any leads

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment