2014-03-02 13:42:18 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
[ -f /etc/samba/smb.conf ] || exit 0
|
|
|
|
|
|
|
|
mkdir -p /var/log/samba
|
|
|
|
|
|
|
|
start() {
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting SMB services: "
|
2014-03-02 13:42:18 +01:00
|
|
|
smbd -D
|
2014-10-26 18:41:43 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2014-03-02 13:42:18 +01:00
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting NMB services: "
|
2014-03-02 13:42:18 +01:00
|
|
|
nmbd -D
|
2014-10-26 18:41:43 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2014-03-02 13:42:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Shutting down SMB services: "
|
2014-03-02 13:42:18 +01:00
|
|
|
kill -9 `pidof smbd`
|
2014-10-26 18:41:43 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2014-03-02 13:42:18 +01:00
|
|
|
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Shutting down NMB services: "
|
2014-03-02 13:42:18 +01:00
|
|
|
kill -9 `pidof nmbd`
|
2014-10-26 18:41:43 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2014-03-02 13:42:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
restart() {
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
}
|
|
|
|
|
|
|
|
reload() {
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Reloading smb.conf file: "
|
2014-03-02 13:42:18 +01:00
|
|
|
kill -HUP `pidof smbd`
|
2014-10-26 18:41:43 +01:00
|
|
|
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
2014-03-02 13:42:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
restart
|
|
|
|
;;
|
|
|
|
reload)
|
|
|
|
reload
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 {start|stop|restart|reload}"
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $?
|