4 # description: Starts and stops the Samba smbd and nmbd daemons \
5 # used to provide SMB network services.
7 # config: /etc/samba/smb.conf
8 # config: /etc/samba/lmhosts
12 # Source function library.
13 . /etc/rc.d/init.d/functions
15 # Source networking configuration.
16 . /etc/sysconfig/network
19 CFGFILE="/etc/samba/smb.conf"
20 smbd_pidfile="/var/run/smbd.pid"
21 nmbd_pidfile="/var/run/nmbd.pid"
24 # Demon specified configuration.
25 . /etc/sysconfig/samba
27 # Check that networking is up.
28 if is_yes "${NETWORKING}"; then
29 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
30 msg_network_down "Samba SMB/CIFS Server"
37 TMPDIR="/tmp"; export TMPDIR
41 # Check if the service is already running?
42 if [ -f /var/lock/subsys/$lockname ]; then
43 msg_already_running "Samba SMB/CIFS Server"
47 msg_starting "Samba SMB/CIFS Server"
48 daemon /usr/sbin/smbd -D -s $CFGFILE
50 msg_starting "Samba NetBIOS Name Server"
51 daemon /usr/sbin/nmbd -D $CFGFILE
52 [ $RETVAL -eq 0 ] && RETVAL=$?
53 if [ $RETVAL -eq 0 ]; then
54 touch /var/lock/subsys/$lockname
60 if [ ! -f /var/lock/subsys/$lockname ]; then
61 msg_not_running "Samba SMB/CIFS Server"
65 msg_stopping "Samba SMB/CIFS Server"
66 killproc --pidfile $smbd_pidfile smbd
68 msg_stopping "Samba NetBIOS Name Server"
69 killproc --pidfile $nmbd_pidfile nmbd
70 rm -f /var/lock/subsys/$lockname >/dev/null 2>&1
74 if [ ! -f /var/lock/subsys/$lockname ]; then
75 msg_not_running "Samba SMB/CIFS Server"
80 msg_reloading "Samba SMB/CIFS Server"
81 killproc --pidfile $smbd_pidfile smbd -HUP
86 if [ ! -f /var/lock/subsys/$lockname ]; then
87 msg_not_running "Samba SMB/CIFS Server"
101 [ $RETVAL -eq 0 ] && RETVAL=$RET
105 # See how we were called.
127 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"