]> git.pld-linux.org Git - packages/rsync.git/blobdiff - rsync.init
- rel 2 for th
[packages/rsync.git] / rsync.init
index f001708c1a0017fd32fc9293535a9eaa67b62e27..d176e5dd9ea9a1d9b82de058046532e1bfbc48da 100644 (file)
@@ -27,10 +27,7 @@ fi
 # Get service configuration
 [ -f /etc/sysconfig/rsyncd ] && . /etc/sysconfig/rsyncd
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Start daemons.
        if [ ! -f /var/lock/subsys/rsyncd ]; then
                msg_starting rsyncd
@@ -40,8 +37,9 @@ case "$1" in
        else
                msg_already_running rsyncd
        fi
-       ;;
-  stop)
+}
+
+stop() {
        # Stop daemons.
        if [ -f /var/lock/subsys/rsyncd ]; then
                msg_stopping rsyncd
@@ -50,18 +48,43 @@ case "$1" in
        else
                msg_not_running rsyncd
        fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/rsyncd ]; then
+               stop
+               start
+       else
+               msg_not_running rsyncd
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
        ;;
-  restart|force-restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status rsyncd rsync
        exit $?
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|force-restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
        exit 3
 esac
 
This page took 0.225687 seconds and 4 git commands to generate.