]> git.pld-linux.org Git - packages/proftpd.git/commitdiff
- use functions, add try-restart
authorElan Ruusamäe <glen@pld-linux.org>
Sat, 25 Oct 2008 19:51:34 +0000 (19:51 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    proftpd.init -> 1.10

proftpd.init

index c4849d0d788527e5b54d69e5f1d4dff978e47636..bc87061ed8cad3b22f2ea168b967c1bfc9929e98 100644 (file)
@@ -29,10 +29,7 @@ else
        exit 0
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/proftpd ]; then
                msg_starting ProFTPD
@@ -42,8 +39,9 @@ case "$1" in
        else
                msg_already_running ProFTPD
        fi
-       ;;
-  stop)
+}
+
+stop() {
        # Stop daemons.
        if [ -f /var/lock/subsys/proftpd ]; then
                msg_stopping ProFTPD
@@ -52,18 +50,44 @@ case "$1" in
        else
                msg_not_running ProFTPD
        fi
+}
+
+
+condrestart() {
+       if [ -f /var/lock/subsys/proftpd ]; then
+               stop
+               start
+       else
+               msg_not_running proftpd
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status proftpd
        exit $?
        ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
-       ;;
   *)
-       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
        exit 3
 esac
 
This page took 0.043542 seconds and 4 git commands to generate.