bc7d70
diff -up openwsman-2.2.7/etc/init/openwsmand.sh.cmake.orig openwsman-2.2.7/etc/init/openwsmand.sh.cmake
bc7d70
--- openwsman-2.2.7/etc/init/openwsmand.sh.cmake.orig	2012-01-11 13:38:58.789392556 +0100
bc7d70
+++ openwsman-2.2.7/etc/init/openwsmand.sh.cmake	2012-01-11 13:44:32.383593944 +0100
ab6512
@@ -4,28 +4,28 @@
ab6512
 # Provides: openwsmand
ab6512
 # Required-Start: $remote_fs
ab6512
 # Required-Stop: $network
bc7d70
-# Default-Start: 2 3 5
ab6512
-# Default-Stop: 0 1 6 
ab6512
+# Default-Start:
ab6512
+# Default-Stop:
ab6512
 # Short-Description: Openwsman Daemon
ab6512
 # Description: openwsmand
ab6512
 #       Start/Stop the Openwsman Daemon
ab6512
 ### END INIT INFO
ab6512
 #
ab6512
 #
ab6512
-# chkconfig: 2345 36 64
ab6512
+# chkconfig: - 36 64
ab6512
 # description: Openwsman Daemon
ab6512
 # processname: openwsmand
ab6512
 
6091aa
 NAME=openwsmand
6091aa
 DAEMON=/usr/sbin/$NAME
6091aa
 OPTIONS=-S # with SSL
6091aa
-PIDFILE=/var/run/$NAME.pid
6091aa
+PIDFILE=/var/run/wsmand.pid
6091aa
 
6091aa
 lsb=0
6091aa
 
6091aa
 if [ $EUID != 0 ]; then
6091aa
  echo "This script must be run as root."
6091aa
- exit 1;
6091aa
+ exit 4;
6091aa
 fi
6091aa
 
6091aa
 if [ "$DESCRIPTIVE" = "" ]; then
6091aa
@@ -65,6 +65,7 @@ start()
6091aa
 
6091aa
 	echo "NOTE: The script uses /dev/random device for generating some random bits while generating the server key."
ab6512
 	echo "      If this takes too long, you can replace the value of \"RANDFILE\" in @SYSCONFDIR@/ssleay.cnf with /dev/urandom. Please understand the implications of replacing the RNADFILE."
ab6512
+	exit 6 # Six means "program is not configured", seems to be suitable value
6091aa
 		
6091aa
       fi
6091aa
     fi
6091aa
@@ -103,6 +104,9 @@ case "$1" in
6091aa
     stop)
6091aa
     	stop
6091aa
 	rm -f $lockfile
6091aa
+	# pid file should be removed by server itself, but it's marked as
6091aa
+	# TODO in wsmand.c source file;)
ab6512
+	rm -f $PIDFILE
6091aa
     ;;
6091aa
 
6091aa
     restart)
ab6512
@@ -137,6 +141,16 @@ case "$1" in
6091aa
         echo "             running"
6091aa
       else
ab6512
         echo "             stopped"
bc7d70
+	if [ -e $PIDFILE ]; then
bc7d70
+	  echo "             stopped, but pid file exists"
bc7d70
+	  exit 1
bc7d70
+	elif [ -e $lockfile ]; then
bc7d70
+	  echo "             stopped, but lock file exists"
bc7d70
+	  exit 2
bc7d70
+	else
bc7d70
+	  echo "             stopped"
bc7d70
+	  exit 3
bc7d70
+	fi
6091aa
       fi
6091aa
     fi
6091aa
     ;;
ab6512
@@ -147,6 +161,8 @@ case "$1" in
6091aa
 
6091aa
     *)
ab6512
     echo "Usage: $0 {restart|start|stop|reload|force-reload|status|condrestart}"
6091aa
+    [ "$1" = "usage" ] && exit 0
6091aa
+    exit 2
6091aa
 esac
6091aa
 
6091aa
 if [ $lsb -ne 0 ]; then