Skip to content
Browse files

Updated management script

  • Loading branch information...
1 parent 6ba80fa commit bd4671c07e9653cdf85688ecd7484470cf0b2534 Stephen Shaw committed May 19, 2012
Showing with 22 additions and 5 deletions.
  1. +22 −5 porick.sh
View
27 porick.sh
@@ -10,7 +10,11 @@ APPCONFIG="$APPDIR/production.ini"
PIDFILE="$APPDIR/porick.pid"
-PYTHONPATH=':/usr/local/lib/python2.6/dist-packages/FormEncode-1.2.4-py2.6.egg:/usr/local/lib/python2.6/dist-packages/simplejson-2.5.2-py2.6.egg:/usr/local/lib/python2.6/dist-packages/decorator-3.3.3-py2.6.egg:/usr/local/lib/python2.6/dist-packages/nose-1.1.2-py2.6.egg:/usr/local/lib/python2.6/dist-packages/Mako-0.7.0-py2.6.egg:/usr/local/lib/python2.6/dist-packages/WebError-0.10.3-py2.6.egg:/usr/local/lib/python2.6/dist-packages/WebTest-1.3.4-py2.6.egg:/usr/local/lib/python2.6/dist-packages/Tempita-0.5.1-py2.6.egg:/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.7.7-py2.6-linux-x86_64.egg:/usr/local/lib/python2.6/dist-packages/Pylons-1.0.1rc1-py2.6.egg:/usr/local/lib/python2.6/dist-packages/WebOb-1.2b3-py2.6.egg:/usr/local/lib/python2.6/dist-packages/MarkupSafe-0.15-py2.6.egg:'
+PYTHONPATH=':/usr/local/lib/python2.6/dist-packages/FormEncode-1.2.4-py2.6.egg:/usr/local/lib/python2.6/dist-packages/simplejson-2.5.2-py2.6.egg:/usr/local/lib/python2.6/dist-packages/decorator
+-3.3.3-py2.6.egg:/usr/local/lib/python2.6/dist-packages/nose-1.1.2-py2.6.egg:/usr/local/lib/python2.6/dist-packages/Mako-0.7.0-py2.6.egg:/usr/local/lib/python2.6/dist-packages/WebError-0.10.3-p
+y2.6.egg:/usr/local/lib/python2.6/dist-packages/WebTest-1.3.4-py2.6.egg:/usr/local/lib/python2.6/dist-packages/Tempita-0.5.1-py2.6.egg:/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.7.7-py
+2.6-linux-x86_64.egg:/usr/local/lib/python2.6/dist-packages/Pylons-1.0.1rc1-py2.6.egg:/usr/local/lib/python2.6/dist-packages/WebOb-1.2b3-py2.6.egg:/usr/local/lib/python2.6/dist-packages/MarkupS
+afe-0.15-py2.6.egg:'
running () {
[ -f $PIDFILE ]
@@ -22,7 +26,7 @@ die () {
}
pid () {
- cat $PIDFILE | head -n 1
+ head -n 1 "$PIDFILE"
}
start_server () {
@@ -31,8 +35,9 @@ start_server () {
fi
cd $APPDIR
- exec su -m www-data -c "PYTHONPATH='$PYTHONPATH' paster serve $APPCONFIG --pid-file=$PIDFILE &"
+ exec su -m www-data -c "PYTHONPATH='$PYTHONPATH' paster serve $APPCONFIG --pid-file=$PIDFILE &" >/dev/null 2>&1
}
+
stop_server () {
if ! running; then
die "Porick isn't running"
@@ -41,6 +46,12 @@ stop_server () {
kill $(pid) && rm -f $PIDFILE
}
+restart_server () {
+ stop_server
+ sleep 1
+ start_server
+}
+
server_status () {
if running; then
echo "Running (PID: $(pid))"
@@ -49,11 +60,17 @@ server_status () {
fi
}
+reload_config () {
+ exec "paster setup-app $APPCONFIG"
+}
+
[ "$1" = "start" ] && (shift; start_server; exit)
[ "$1" = "stop" ] && (shift; stop_server; exit)
+[ "$1" = "restart" ] && (shift; restart_server; exit)
+[ "$1" = "reload" ] && (shift; restart_server; exit)
[ "$1" = "status" ] && (shift; server_status; exit)
-cat <<EOF
-Usage: $0 <start|stop|status>
+[ $# != 1 ] && cat <<EOF
+Usage: $0 <start|stop|restart|reload|status>
EOF

0 comments on commit bd4671c

Please sign in to comment.
Something went wrong with that request. Please try again.