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