+status() {
+ if [ -f $PID_FILE ];then
+ PID=`cat $PID_FILE`
+ else
+ echo $APP is not running
+ return $RETVAL
+ fi
+ kill -0 $PID &> /dev/null
+ PID_EXISTS=$?
+ if [ $PID_EXISTS -eq 0 ]; then
+ echo $APP is running with pid $PID ...
+ else
+ echo No $APP process with pid $PID, removing $PID_FILE
+ rm -f $PID_FILE
+ fi
+ return $RETVAL
+}
+
+# main