mirror of
https://github.com/samba-team/samba.git
synced 2025-03-05 20:58:40 +03:00
Initscript from 2.2.4 tree.
(This used to be commit d61f3810443a1828ea8c6c6782708f3ddd7caaea)
This commit is contained in:
parent
96300f6008
commit
590bace59d
@ -21,6 +21,10 @@ NAME_S=smbd
|
||||
DAEMON_S=/usr/sbin/$NAME_S
|
||||
NAME_N=nmbd
|
||||
DAEMON_N=/usr/sbin/$NAME_N
|
||||
NAME_W=winbindd
|
||||
DAEMON_W=/usr/sbin/$NAME_W
|
||||
|
||||
config_file=/etc/samba.d/smb.conf
|
||||
|
||||
# Source function library (and set vital variables).
|
||||
. @SVIdir@/functions
|
||||
@ -36,14 +40,44 @@ status() {
|
||||
return 0 # seems to be up and running
|
||||
}
|
||||
|
||||
# this function is dedicated to Jan Terpstra. -- Klaus Singvogel, Sep. 2001.
|
||||
WinbdConfig() {
|
||||
# returns 0 if winbindd is not configured,
|
||||
# and 1 if winbindd is configured.
|
||||
|
||||
local config_file=$1; shift # file to check
|
||||
|
||||
# check if "winbind uid" is set in samba config file
|
||||
egrep -q '[^#]*winbind uid' $config_file || return 0
|
||||
|
||||
found=0;
|
||||
# We also need to check if least one PAM module control file does
|
||||
# NOT have pam_winbind.so commented out
|
||||
for i in /etc/pam.d/*; do
|
||||
if [ ! -f $i ]; then next; fi
|
||||
egrep -q '[^#]*pam_winbind.so' $i && found=1 && break;
|
||||
done
|
||||
|
||||
if [ $found != 0 ]; then
|
||||
# if so, ensure that in /etc/nsswitch.conf we have for
|
||||
# "passwd", "shadow", "group" an entry for "winbind"
|
||||
egrep -q '^passwd:.*winbind' /etc/nsswitch.conf && return 1
|
||||
egrep -q '^shadow:.*winbind' /etc/nsswitch.conf && return 1
|
||||
egrep -q '^group:.*winbind' /etc/nsswitch.conf && return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ ! -e $SVIlock ] || exit 0
|
||||
[ -x $DAEMON_S -a -x $DAEMON_N ] || exit 5
|
||||
SVIemptyConfig /etc/samba.d/smb.conf && exit 6
|
||||
SVIemptyConfig $config_file && exit 6
|
||||
|
||||
echo -n "Starting $SVIsubsys services: "
|
||||
ssd -S -n $NAME_S -x $DAEMON_S -- $OPTIONS_SMB
|
||||
WinbdConfig $config_file || ssd -S -n $NAME_W -x $DAEMON_W -- $OPTIONS_WINBD
|
||||
ssd -S -n $NAME_N -x $DAEMON_N -- $OPTIONS_NMB
|
||||
ret=$?
|
||||
|
||||
@ -55,8 +89,9 @@ case "$1" in
|
||||
[ -e $SVIlock ] || exit 0
|
||||
|
||||
echo -n "Stopping $SVIsubsys services: "
|
||||
ssd -K -p /var/lock/samba.d/$NAME_N.pid -n $NAME_N #-x $DAEMON_N
|
||||
ssd -K -p /var/lock/samba.d/$NAME_S.pid -n $NAME_S #-x $DAEMON_S
|
||||
ssd -K -p /var/lock/samba.d/$NAME_W.pid -n $NAME_W #-x $DAEMON_W
|
||||
ssd -K -p /var/lock/samba.d/$NAME_N.pid -n $NAME_N #-x $DAEMON_N
|
||||
|
||||
ret=$?
|
||||
|
||||
@ -73,6 +108,8 @@ case "$1" in
|
||||
reload)
|
||||
echo -n "Reloading $SVIsubsys service configuration: "
|
||||
# nmbd has no config file to reload
|
||||
ssd -K --signal 1 -p /var/lock/samba.d/$NAME_N.pid -n $NAME_N #-x $DAEMON_N
|
||||
ssd -K --signal 1 -p /var/lock/samba.d/$NAME_W.pid -n $NAME_W #-x $DAEMON_W
|
||||
ssd -K --signal 1 -p /var/lock/samba.d/$NAME_S.pid -n $NAME_S #-x $DAEMON_S
|
||||
ret=$?
|
||||
echo "."
|
||||
|
Loading…
x
Reference in New Issue
Block a user