+++ /dev/null
-#!/bin/bash
-
-HOMEDIR=$(dirname $(readlink $0))
-LOGFILE=/var/log/webapp/error.log
-
-case "$1" in
- start)
- 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)
- 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)
- $0 stop
- sleep 2
- $0 start
- ;;
-
- check)
- if ps ax | grep -v grep | grep webapp.py > /dev/null
- then
- :
-# echo "webapp is running..."
- else
- echo "webapp is not running!"
- $0 start
- fi
- ;;
-
- *)
- echo "usage: webapp [ start | stop | restart | check ]"
- ;;
-
-esac