4
# description: Starts and stops the Samba smbd and nmbd daemons \
5
# used to provide SMB network services.
7
# pidfile: /var/run/samba/smbd.pid
8
# pidfile: /var/run/samba/nmbd.pid
9
# config: /etc/samba/smb.conf
12
# Source function library.
13
if [ -f /etc/init.d/functions ] ; then
14
. /etc/init.d/functions
15
elif [ -f /etc/rc.d/init.d/functions ] ; then
16
. /etc/rc.d/init.d/functions
21
# Avoid using root's TMPDIR
24
# Source networking configuration.
25
. /etc/sysconfig/network
27
if [ -f /etc/sysconfig/samba ]; then
28
. /etc/sysconfig/samba
31
# Check that networking is up.
32
[ ${NETWORKING} = "no" ] && exit 0
34
# Check that smb.conf exists.
35
[ -f /etc/samba/smb.conf ] || exit 0
37
# Check that we can write to it... so non-root users stop here
38
[ -w /etc/samba/smb.conf ] || exit 0
40
# Check whether "netbios disabled" is true
41
#ISNETBIOSDISABLED=$(testparm -s 2>/dev/null | \
42
# sed -n '/\[global\]/,/^$/p' | \
43
# grep "disable netbios = Yes" | \
44
# awk 'BEGIN{FS=" = "}{print $2}')
53
echo -n $"Starting $KIND services: "
54
daemon smbd $SMBDOPTIONS
58
if [ x"$ISNETBIOSDISABLED" != x"Yes" ]; then
59
echo -n $"Starting $KIND services: "
60
daemon nmbd $NMBDOPTIONS
63
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/smb || \
66
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/smb || \
74
echo -n $"Shutting down $KIND services: "
77
[ $RETVAL -eq 0 ] && rm -f /var/run/smbd.pid
80
if [ x"$ISNETBIOSDISABLED" != x"Yes" ]; then
81
echo -n $"Shutting down $KIND services: "
84
[ $RETVAL2 -eq 0 ] && rm -f /var/run/nmbd.pid
85
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/smb
88
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/smb
100
echo -n $"Reloading smb.conf file: "
129
[ -f /var/lock/subsys/smb ] && restart || :
132
echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"