2009-08-26 17:00:38 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# /etc/rc.d/rc.samba
|
|
|
|
#
|
|
|
|
# Start/stop/restart the Samba SMB file/print server.
|
|
|
|
#
|
|
|
|
# To make Samba start automatically at boot, make this
|
|
|
|
# file executable: chmod 755 /etc/rc.d/rc.samba
|
|
|
|
#
|
|
|
|
|
|
|
|
samba_start() {
|
|
|
|
if [ -x /usr/sbin/smbd -a -x /usr/sbin/nmbd -a -r /etc/samba/smb.conf ]; then
|
2016-06-30 22:26:57 +02:00
|
|
|
mkdir -p /var/run/samba
|
2009-08-26 17:00:38 +02:00
|
|
|
echo "Starting Samba: /usr/sbin/smbd -D"
|
|
|
|
/usr/sbin/smbd -D
|
|
|
|
echo " /usr/sbin/nmbd -D"
|
|
|
|
/usr/sbin/nmbd -D
|
2016-06-30 22:26:57 +02:00
|
|
|
elif [ ! -r /etc/samba/smb.conf ]; then
|
|
|
|
echo "ERROR: cannot start Samba since /etc/samba/smb.conf does not exist"
|
2009-08-26 17:00:38 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
samba_stop() {
|
|
|
|
killall smbd nmbd
|
|
|
|
}
|
|
|
|
|
|
|
|
samba_restart() {
|
|
|
|
samba_stop
|
|
|
|
sleep 2
|
|
|
|
samba_start
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
'start')
|
|
|
|
samba_start
|
|
|
|
;;
|
|
|
|
'stop')
|
|
|
|
samba_stop
|
|
|
|
;;
|
|
|
|
'restart')
|
|
|
|
samba_restart
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# Default is "start", for backwards compatibility with previous
|
|
|
|
# Slackware versions. This may change to a 'usage' error someday.
|
|
|
|
samba_start
|
|
|
|
esac
|
|
|
|
|