]> git.ipfire.org Git - ipfire.org.git/commitdiff
A litte bit more confort in the init script.
authorJan Paul Tuecking <earl@ipfire.org>
Mon, 14 Jun 2010 18:25:27 +0000 (20:25 +0200)
committerJan Paul Tuecking <earl@ipfire.org>
Mon, 14 Jun 2010 18:25:27 +0000 (20:25 +0200)
www/webapp.init

index 8b8e459981c0db9fd6eacdf203430e888779c0e9..42079830f788991d7bc38f0047112cf1a3f13932 100755 (executable)
@@ -5,11 +5,23 @@ LOGFILE=/srv/logs/www/webapp.error.log
 
 case "$1" in
        start)
-               cd ${HOMEDIR} && ./webapp.py >>${LOGFILE} 2>&1 &
+               if ps ax | grep -v grep | grep webapp.py > /dev/null
+               then
+               echo "webapp is allready running..."
+       else
+                       echo "Starting webapp..."
+                       cd ${HOMEDIR} && ./webapp.py >>${LOGFILE} 2>&1 &
+               fi
                ;;
 
        stop)
-               killall webapp.py
+               if ps ax | grep -v grep | grep webapp.py > /dev/null
+               then
+                       echo "Stopping webapp..."
+                       killall webapp.py &> /dev/null
+       else
+                       echo "webapp is not running..."
+               fi
                ;;
 
        restart)
@@ -19,10 +31,17 @@ case "$1" in
                ;;
 
        check)
-               if (ps aux | grep -q webapp.py); then
-                       : # Process is running...
+               if ps ax | grep -v grep | grep webapp.py > /dev/null
+                       then
+               echo "webapp is running..."
                else
-                       $0 restart
-               fi
+                       echo "webapp is not running!" 
+                       $0 start
+                       fi
+               ;;
+               
+               *)
+               echo "usage: webapp [ start | stop | restart | check ]"
                ;;
+               
 esac