]> git.pld-linux.org Git - packages/samba.git/commitdiff
- use functions
authorJakub Bogusz <qboosh@pld-linux.org>
Tue, 14 Oct 2008 21:11:01 +0000 (21:11 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- added try-restart

Changed files:
    winbind.init -> 1.8

winbind.init

index 7269d7a078a28550ffbf0b96f9f6b0d9d6fac8a6..8497e91a4383405081cfdbe0bf520b052963d3c6 100644 (file)
@@ -32,13 +32,9 @@ TMPDIR="/tmp"; export TMPDIR
 # Check that smb.conf exists.
 [ -f /etc/samba/smb.conf ] || exit 0
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
-       # Check if the service is already running?
+start() {
        if [ ! -f /var/lock/subsys/winbind ]; then
-               if [ "`grep -i 'idmap uid' /etc/samba/smb.conf | egrep -v [\#\;]`" -a "`grep -i 'idmap gid' /etc/samba/smb.conf | egrep -v [\#\;]`" ]; then
+               if [ "`grep -i 'idmap uid' /etc/samba/smb.conf | egrep -v [\#\;]`" -a "`grep -i 'idmap gid' /etc/samba/smb.conf | egrep -v [\#\;]`" ]; then
                        msg_starting winbindd
                        daemon winbindd
                        RETVAL=$?
@@ -50,9 +46,9 @@ case "$1" in
        else
                msg_already_running winbindd
        fi
-       ;;
-  stop)
-       # Stop daemon.
+}
+
+stop() {
        if [ -f /var/lock/subsys/winbind ]; then
                msg_stopping winbindd
                killproc winbindd
@@ -60,15 +56,30 @@ case "$1" in
        else
                msg_not_running winbindd
        fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/winbind ]; then
+               stop
+               start
+       else
+               msg_not_running winbindd
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
        ;;
-  status)
-       status winbindd
-       RETVAL=$?
+  stop)
+       stop
        ;;
   restart)
-       $0 stop
-       $0 start
-       exit $?
+       stop
+       start
        ;;
   reload|force-reload)
        if [ -f /var/lock/subsys/winbind ]; then
@@ -80,8 +91,15 @@ case "$1" in
                exit 7
        fi
        ;;
+  try-restart)
+       condrestart 0
+       ;;
+  status)
+       status winbindd
+       RETVAL=$?
+       ;;
   *)
-       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
 
This page took 0.230972 seconds and 4 git commands to generate.