Author: glen                         Date: Mon Mar 29 10:33:26 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- unify with template.init

---- Files affected:
packages/unison:
   unison.init (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: packages/unison/unison.init
diff -u packages/unison/unison.init:1.2 packages/unison/unison.init:1.3
--- packages/unison/unison.init:1.2     Thu Dec  8 01:41:26 2005
+++ packages/unison/unison.init Mon Mar 29 12:33:20 2010
@@ -3,8 +3,12 @@
 # unison       server
 #
 # chkconfig:   345 85 15
+#
 # description: unison is a file synchronization daemon
+#
 # processname: unison
+#
+# $Id$
 
 # Source function library
 . /etc/rc.d/init.d/functions
@@ -12,56 +16,80 @@
 # Get network config
 . /etc/sysconfig/network
 
-# set defaults
-
-# Get service config
+# Get service config - may override defaults
 [ -f /etc/sysconfig/unison ] && . /etc/sysconfig/unison
 
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
        if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; 
then
-               msg_network_down unison
+               msg_network_down "Unison"
                exit 1
        fi
 else
        exit 0
 fi
 
+start() {
+       # Check if the service is already running?
+       if [ -f /var/lock/subsys/unison ]; then
+               msg_already_running "Unison"
+               return
+       fi
+
+       msg_starting "Unison"
+       daemon --fork env HOME=/var/lib/unison /usr/bin/unison $OPTIONS -socket 
1001 -terse -silent
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/unison
+}
+
+stop() {
+       if [ ! -f /var/lock/subsys/unison ]; then
+               msg_not_running "Unison"
+               return
+       fi
+
+       # Stop daemons.
+       msg_stopping "Unison"
+       killproc unison
+       rm -f /var/lock/subsys/unison
+}
+
+condrestart() {
+       if [ ! -f /var/lock/subsys/unison ]; then
+               msg_not_running "Unison"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
+
 RETVAL=0
 # See how we were called.
 case "$1" in
   start)
-       # Check if the service is already running?
-       if [ ! -f /var/lock/subsys/unison ]; then
-               msg_starting Unison
-               daemon --fork env HOME=/var/lib/unison /usr/bin/unison $OPTIONS 
-socket 1001 -terse -silent
-               RETVAL=$?
-               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/unison
-       else
-               msg_already_running unison
-       fi
+       start
        ;;
   stop)
-       # Stop daemons.
-       if [ -f /var/lock/subsys/unison ]; then
-               msg_stopping unison
-               killproc unison
-               rm -f /var/lock/subsys/unison > /dev/null 2>&1
-       else
-               msg_not_running unison
-       fi
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status unison
-       exit $?
-       ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+       RETVAL=$?
        ;;
   *)
-       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/packages/unison/unison.init?r1=1.2&r2=1.3&f=u

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

Reply via email to