Permalink
Browse files

added hacked together init script.

  • Loading branch information...
1 parent e3b75bd commit 5ace1ba315823643a07b9372e17a3142288c3ccd @uberj committed Dec 18, 2011
Showing with 46 additions and 0 deletions.
  1. +46 −0 glaspot/glaspot
View
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+GLASPOT="/opt/glaspot/trunk"
+PID_FILE="/var/run/glaspot.pid"
+
+do_start () {
+
+ if [ -f $PID_FILE ]
+ then
+ echo "pidfile $PID_FILE already exists."
+ else
+ cd $GLASPOT
+ python webserver.py
+ echo $! > /var/run/glaspot.pid
+ fi
+
+}
+do_stop () {
+
+ if [ -f $PID_FILE ]
+ then
+ echo "Stopping..."
+ kill < $(cat $PID_FILE)
+ else
+ echo "No pidfile. If you sure glaspot is running kill it manually"
+ fi
+
+}
+case "$1" in
+ start)
+ do_start
+ ;;
+ stop)
+ do_stop
+ ;;
+
+ restart)
+ do_start
+ do_stop
+ ;;
+ *)
+ echo "Usage: /etc/init.d/glaspot {start|stop|restart}"
+ exit 1
+esac
+
+exit 0

0 comments on commit 5ace1ba

Please sign in to comment.