]> git.pld-linux.org Git - packages/samba.git/blobdiff - winbind.init
- renumber patches
[packages/samba.git] / winbind.init
index 5f800ccce762be58a4f14611cf04adaf2c66836c..a421fdecacfcecad8f9c77411eabd58a441602f0 100644 (file)
@@ -14,6 +14,9 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
 # Source networking configuration.
 . /etc/sysconfig/network
 
+# Daemon specific configuration.
+. /etc/sysconfig/winbind
+
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
        if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
@@ -29,36 +32,21 @@ 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)
-  
-               daemon winbindd
-               RETVAL=$?
-       else
-               echo "Winbind is not configured in /etc/samba/smb.conf, not starting"
-       fi
-       echo
-       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/winbind || \
-          RETVAL=1
-       return $RETVAL
-
-       # 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
-                       msg_starting winbindd
-                       daemon $NICELEVEL winbindd -D
-                       RETVAL=$?
-                       [ $RETVAL -eq 0] && touch /var/lock/subsys/winbind || \
+               msg_starting winbindd
+               daemon /usr/sbin/winbindd
+               RETVAL=$?
+               if [ $RETVAL -eq 0 ]; then
+                       touch /var/lock/subsys/winbind
                        RETVAL=1
-               fi 
+               fi
        else
                msg_already_running winbindd
        fi
-       ;;
-  stop)
-       # Stop daemon.
+}
+
+stop() {
        if [ -f /var/lock/subsys/winbind ]; then
                msg_stopping winbindd
                killproc winbindd
@@ -66,16 +54,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=$?       
-       [ $RETVAL -eq 0 ] && RETVAL=$RET
+  stop)
+       stop
        ;;
   restart)
-       $0 stop
-       $0 start
-       exit $?
+       stop
+       start
        ;;
   reload|force-reload)
        if [ -f /var/lock/subsys/winbind ]; then
@@ -83,12 +85,19 @@ case "$1" in
                killproc winbindd -HUP
                RETVAL=$?
        else
-               msg_not_running winbindd >&2
+               msg_not_running winbindd
                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.07855 seconds and 4 git commands to generate.