diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2014-08-20 18:10:23 -0300 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2014-08-21 10:50:46 -0300 |
commit | 7212e22507e02f3418b4568ef8a20b58e6c3f135 (patch) | |
tree | cd68f518ed4bc804a7f31bf6aa96919368a32a29 /service/user-agent-deamon | |
parent | 44e1ff7a6ce3329f747cb6a52c91bc47a0c8c93c (diff) |
adding deamon start|stop|restart|killall scripts for the service and py-fake-service
Diffstat (limited to 'service/user-agent-deamon')
-rwxr-xr-x | service/user-agent-deamon | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/service/user-agent-deamon b/service/user-agent-deamon new file mode 100755 index 00000000..84493d2d --- /dev/null +++ b/service/user-agent-deamon @@ -0,0 +1,33 @@ +#!/bin/bash +export PYTHONPATH=`pwd`/app:$PYTHONPATH + +USER_AGENT_PORT=3333 + +function do_stop() { + test -e gunicorn.pid && (kill -9 $(cat gunicorn.pid) && rm gunicorn.pid && echo "Stopped User Agent") || echo "User Agent is not running" +} + +function do_start() { + echo "gunicorn pixelated_user_agent:app -b 0.0.0.0:$USER_AGENT_PORT -D -p gunicorn.pid --log-file=gunicorn.log" + gunicorn pixelated_user_agent:app -b 0.0.0.0:$USER_AGENT_PORT -D -p gunicorn.pid --log-file=gunicorn.log +} + +case $1 in + restart) + do_stop && do_start + ;; + start) + do_start + ;; + stop) + do_stop + ;; + killall) + pgrep -f gunicorn | xargs kill -9 + rm -rf gunicorn.pid + ;; + *) + echo "usage: start|stop|restart|killall" + ;; +esac + |