Author: qboosh                       Date: Tue Dec 25 12:22:23 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- force-reload is not supposed to start service if not running
- added try-reload action

---- Files affected:
SOURCES:
   dhcp-relay.init (1.17 -> 1.18) 

---- Diffs:

================================================================
Index: SOURCES/dhcp-relay.init
diff -u SOURCES/dhcp-relay.init:1.17 SOURCES/dhcp-relay.init:1.18
--- SOURCES/dhcp-relay.init:1.17        Wed Jun  1 15:45:26 2005
+++ SOURCES/dhcp-relay.init     Tue Dec 25 13:22:18 2007
@@ -30,11 +30,7 @@
        done
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
-       # Check if the service is already running?
+start() {
        if [ ! -f /var/lock/subsys/dhcp-relay ]; then
                msg_starting "DHCP relay"
                daemon dhcrelay $OPTIONS $DHCP_SERVERS_IP
@@ -43,8 +39,9 @@
        else
                msg_already_running "DHCP relay"
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/dhcp-relay ]; then
                msg_stopping "DHCP relay"
                killproc dhcrelay
@@ -52,18 +49,43 @@
        else
                msg_not_running "DHCP relay"
        fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/dhcp-relay ]; then
+               stop
+               start
+       else
+               msg_not_running "DHCP relay"
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
        ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status dhcrelay
        exit $?
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
        exit 3
 esac
 
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/dhcp-relay.init?r1=1.17&r2=1.18&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to