openwsman/openwsman-2.2.3-initscript.patch
2012-01-11 15:44:59 +01:00

82 lines
2.1 KiB
Diff

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
@@ -4,28 +4,28 @@
# Provides: openwsmand
# Required-Start: $remote_fs
# Required-Stop: $network
-# Default-Start: 2 3 5
-# 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
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."
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
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;)
+ rm -f $PIDFILE
;;
restart)
@@ -137,6 +141,16 @@ case "$1" in
echo " running"
else
echo " stopped"
+ 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
fi
fi
;;
@@ -147,6 +161,8 @@ case "$1" in
*)
echo "Usage: $0 {restart|start|stop|reload|force-reload|status|condrestart}"
+ [ "$1" = "usage" ] && exit 0
+ exit 2
esac
if [ $lsb -ne 0 ]; then