#!/bin/sh
. /lib/lsb/init-functions
if test ! -f /etc/samba/smb.conf; then
log_failure_msg "The smb.conf file does not exist."
exit 6
fi
if test ! -f /usr/sbin/nmbd -o ! -f /usr/sbin/smbd; then
log_failure_msg "The nmbd and/or smbd daemons are not installed."
exit 5
fi
case "$1" in
start)
start_daemon nmbd -D
start_daemon smbd -D
log_success_msg "Started SMB services."
;;
stop)
killproc smbd
killproc nmbd
log_success_msg "Shutdown SMB services."
;;
reload)
log_success_msg "Reload not necessary with SAMBA."
;;
status)
if test -z "`pidofproc smbd`"; then
log_success_msg "smbd is not running."
else
log_success_msg "smbd is running."
fi
if test -z "`pidofproc nmbd`"; then
log_success_msg "nmbd is not running."
else
log_success_msg "nmbd is running."
fi
;;
restart | force-reload)
$0 stop
$0 start
;;
*)
echo "Usage: smb {start|stop|reload|force-reload|restart|status}"
exit 1
;;
esac
exit 0