| description "Python Application Worker" | |
| stop on stopping python-application | |
| respawn | |
| instance $PORT | |
| chdir {{ chdir }} | |
| # run as user | |
| exec su -s /bin/sh -c 'exec "$0" "$@"' {{ runas }} -- {{ python }} -u {{ script }} -p $PORT |
| description "Python Application" | |
| start on runlevel [2345] | |
| stop on runlevel [!2345] | |
| # normally this sort've thing would have a 'task' stanza, but see [1] | |
| #task | |
| script | |
| for i in `seq {{ first_port }} {{ last_port }}`; do | |
| start python-application-worker PORT=$i || true | |
| done | |
| # [1] hang forever so that when we stop, we emit a stopping event, and our | |
| # workers know to stop themselves | |
| while true | |
| do | |
| sleep 100 | |
| done | |
| end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment