From 858d825982cff76ad51a15de80d84c8afdb4ea3a Mon Sep 17 00:00:00 2001 From: Jan Paul Tuecking Date: Mon, 14 Jun 2010 20:25:27 +0200 Subject: [PATCH] A litte bit more confort in the init script. --- www/webapp.init | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/www/webapp.init b/www/webapp.init index 8b8e4599..42079830 100755 --- a/www/webapp.init +++ b/www/webapp.init @@ -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 -- 2.47.3