Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Periodically restart some services every n seconds/minutes/hours with supervisord
[program:example-server]
command=npm run start:dev
directory=/opt/%(program_name)s
stdout_logfile=/opt/%(program_name)s/data/logs/server.log
redirect_stderr=true
autostart=true
autorestart=true
startretries=5
stopwaitsecs=30
stopsignal=TERM
stopasgroup=true
user=currents
priority=100
[program:argo-server]
command=cloudflared tunnel run --url http://localhost:3000 --hostname sub.example.com
stdout_logfile=/opt/%(program_name)s/data/logs/argo.log
redirect_stderr=true
autostart=true
autorestart=true
startretries=5
stopwaitsecs=10
stopsignal=TERM
stopasgroup=true
user=currents
priority=200
[program:periodicrestarter]
command=/bin/sh -c "echo '[+] Starting periodic restarter...'; date; sleep 86400; echo '[*] Restarting services...'; date; supervisorctl restart examplegroup:"
stdout_logfile=/var/log/periodicrestarter.log
redirect_stderr=true
autostart=true
autorestart=true
startretries=1000000
stopwaitsecs=20
stopsignal=TERM
stopasgroup=true
user=root
priority=1000
[group:examplegroup]
programs=example-server,argo-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment