#!/bin/sh # # chkconfig: 345 91 35 # description: Starts and stops the Samba winbind daemon to provide\ # user and group information from a NT domain controller to linux. # # config: /etc/samba/smb.conf export PATH=/bin:/sbin:/usr/bin:/usr/sbin # Source function library. . /etc/rc.d/init.d/functions # 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 msg_network_down winbindd exit 1 fi else exit 0 fi 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? 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 winbindd RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/winbind || \ RETVAL=1 else nls "Winbind is not configured in /etc/samba/smb.conf, not starting" fi else msg_already_running winbindd fi ;; stop) # Stop daemon. if [ -f /var/lock/subsys/winbind ]; then msg_stopping winbindd killproc winbindd rm -f /var/lock/subsys/winbind >/dev/null 2>&1 else msg_not_running winbindd fi ;; status) status winbindd RETVAL=$? ;; restart) $0 stop $0 start exit $? ;; reload|force-reload) if [ -f /var/lock/subsys/winbind ]; then msg_reloading winbindd killproc winbindd -HUP RETVAL=$? else msg_not_running winbindd >&2 exit 7 fi ;; *) msg_usage "$0 {start|stop|restart|reload|force-reload|status}" exit 3 esac exit $RETVAL