-
-
Save RoboTeddy/bb349098a1b4f6fb577a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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