Author: qboosh                       Date: Tue Oct 28 17:55:18 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- added try-restart

---- Files affected:
SOURCES:
   lircd.init (1.18 -> 1.19) , lircmd.init (1.6 -> 1.7) 

---- Diffs:

================================================================
Index: SOURCES/lircd.init
diff -u SOURCES/lircd.init:1.18 SOURCES/lircd.init:1.19
--- SOURCES/lircd.init:1.18     Wed Nov 15 20:46:13 2006
+++ SOURCES/lircd.init  Tue Oct 28 18:55:12 2008
@@ -51,6 +51,23 @@
        fi
 }
 
+restart() {
+       test -f /var/lock/subsys/lircmd && RESTART_LIRCMD=yes
+       test -n "$RESTART_LIRCMD" && /sbin/service lircmd stop
+       stop
+       start
+       test -n "$RESTART_LIRCMD" && /sbin/service lircmd start
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/lircd ]; then
+               restart
+       else
+               msg_not_running "Linux Infrared Remote Control daemon"
+               RETVAL=$1
+       fi
+}
+
 RETVAL=0
 # See how we were called.
 case "$1" in
@@ -60,16 +77,11 @@
   stop)
        stop
        ;;
-  status)
-       status lircd
-       exit $?
-       ;;
   restart)
-       test -f /var/lock/subsys/lircmd && RESTART_LIRCMD=yes
-       test -n "$RESTART_LIRCMD" && /sbin/service lircmd stop
-       stop
-       start
-       test -n "$RESTART_LIRCMD" && /sbin/service lircmd start
+       restart
+       ;;
+  try-restart)
+       condrestart 0
        ;;
   reload|force-reload)
        if [ -f /var/lock/subsys/lircd ]; then
@@ -81,8 +93,12 @@
                exit 7
        fi
        ;;
+  status)
+       status lircd
+       exit $?
+       ;;
   *)
-       msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+       msg_usage "$0 
{start|stop|restart|try-restart|reload|force-reload|status}"
        exit 3
 esac
 

================================================================
Index: SOURCES/lircmd.init
diff -u SOURCES/lircmd.init:1.6 SOURCES/lircmd.init:1.7
--- SOURCES/lircmd.init:1.6     Sat Sep 27 00:37:42 2003
+++ SOURCES/lircmd.init Tue Oct 28 18:55:13 2008
@@ -14,11 +14,7 @@
 # Source function library
 . /etc/rc.d/init.d/functions
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
-       # Check if the service is already running?
+start() {
        if [ ! -f /var/lock/subsys/lircmd ]; then
                msg_starting "Linux Infrared Remote Control mouse daemon"
                daemon lircmd
@@ -27,9 +23,9 @@
        else
                msg_already_running "Linux Infrared Remote Control mouse daemon"
        fi
-       ;;
-  stop)
-       # Stop daemons.
+}
+
+stop() {
        if [ -f /var/lock/subsys/lircmd ]; then
                msg_stopping "Linux Infrared Remote Control mouse daemon"
                killproc lircmd
@@ -37,15 +33,33 @@
        else
                msg_not_running "Linux Infrared Remote Control mouse daemon"
        fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/lircmd ]; then
+               stop
+               start
+       else
+               msg_not_running "Linux Infrared Remote Control mouse daemon"
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
        ;;
-  status)
-       status lircmd
-       exit $?
+  stop)
+       stop
        ;;
   restart)
-       $0 stop
-       $0 start
-       exit $?
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
        ;;
   reload|force-reload)
        if [ -f /var/lock/subsys/lircmd ]; then
@@ -57,8 +71,12 @@
                exit 7
        fi
        ;;
+  status)
+       status lircmd
+       exit $?
+       ;;
   *)
-       msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+       msg_usage "$0 
{start|stop|restart|try-restart|reload|force-reload|status}"
        exit 3
        ;;
 esac
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/lircd.init?r1=1.18&r2=1.19&f=u
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/lircmd.init?r1=1.6&r2=1.7&f=u

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

Reply via email to