diff -up openwsman-2.2.4/etc/init/openwsmand.sh.cmake.orig openwsman-2.2.4/etc/init/openwsmand.sh.cmake --- openwsman-2.2.4/etc/init/openwsmand.sh.cmake.orig 2010-10-06 11:10:10.000000000 +0200 +++ openwsman-2.2.4/etc/init/openwsmand.sh.cmake 2010-11-11 16:52:19.494661859 +0100 @@ -4,28 +4,28 @@ # Provides: openwsmand # Required-Start: $remote_fs # Required-Stop: $network -# Default-Start: 2 3 4 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