summaryrefslogtreecommitdiff
path: root/fake-service/fake-user-agent-daemon
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@thoughtworks.com>2014-09-15 16:28:31 -0300
committerBruno Wagner <bwagner@thoughtworks.com>2014-09-15 16:28:31 -0300
commit5dc16a1e654e78d9b600578a0e2276cba8d94158 (patch)
tree0b12d78f54a53112e110ecf0e1bcce197f13e3ca /fake-service/fake-user-agent-daemon
parentf2bb13595d67775e8ea89ea595cdbe8b7db96dd8 (diff)
Moved py-fake-service to fake-service, because we only have one now
Diffstat (limited to 'fake-service/fake-user-agent-daemon')
-rwxr-xr-xfake-service/fake-user-agent-daemon33
1 files changed, 33 insertions, 0 deletions
diff --git a/fake-service/fake-user-agent-daemon b/fake-service/fake-user-agent-daemon
new file mode 100755
index 00000000..621f463e
--- /dev/null
+++ b/fake-service/fake-user-agent-daemon
@@ -0,0 +1,33 @@
+#!/bin/bash
+export PYTHONPATH=`pwd`/app:$PYTHONPATH
+
+USER_AGENT_PORT=4567
+
+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
+