2007-01-14 07:13:27 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Stolen from RedHat FC5.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Check that smb.conf exists.
|
|
|
|
[ -f /etc/samba/smb.conf ] || exit 0
|
|
|
|
|
|
|
|
# Make directories.
|
|
|
|
mkdir -p /var/cache/samba
|
|
|
|
mkdir -p /var/log/samba
|
2008-10-06 21:53:29 +02:00
|
|
|
mkdir -p /var/lock/subsys
|
2015-01-19 17:14:11 +01:00
|
|
|
mkdir -p /var/run/samba
|
2007-01-14 07:13:27 +01:00
|
|
|
|
|
|
|
RETVAL=0
|
|
|
|
|
|
|
|
start() {
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting SMB services: "
|
2007-01-14 07:13:27 +01:00
|
|
|
smbd -D
|
|
|
|
RETVAL=$?
|
|
|
|
echo "done"
|
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting NMB services: "
|
2007-01-14 07:13:27 +01:00
|
|
|
nmbd -D
|
|
|
|
RETVAL2=$?
|
|
|
|
echo "done"
|
|
|
|
|
|
|
|
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/smb || \
|
|
|
|
RETVAL=1
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Shutting down SMB services: "
|
2007-01-14 07:13:27 +01:00
|
|
|
kill -9 `pidof smbd`
|
|
|
|
RETVAL=$?
|
2015-01-19 17:14:11 +01:00
|
|
|
rm -f /var/run/samba/smbd.pid
|
2007-01-14 07:13:27 +01:00
|
|
|
echo "done"
|
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Shutting down NMB services: "
|
2007-01-14 07:13:27 +01:00
|
|
|
kill -9 `pidof nmbd`
|
|
|
|
RETVAL2=$?
|
2015-01-19 17:14:11 +01:00
|
|
|
rm -f /var/run/samba/nmbd.pid
|
2007-01-14 07:13:27 +01:00
|
|
|
|
|
|
|
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/smb
|
|
|
|
echo "done"
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
restart() {
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
}
|
|
|
|
|
|
|
|
reload() {
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Reloading smb.conf file: "
|
2007-01-14 07:13:27 +01:00
|
|
|
kill -HUP `pidof smbd`
|
|
|
|
RETVAL=$?
|
|
|
|
echo "done"
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
restart
|
|
|
|
;;
|
|
|
|
reload)
|
|
|
|
reload
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 {start|stop|restart|reload}"
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $?
|