#!/bin/sh ### BEGIN INIT INFO # Provides: samba # Required-Start: # Required-Stop: # Default-Start: # Default-Stop: # Short-Description: ensure Samba daemons are started (nmbd and smbd) ### END INIT INFO set -e # start nmbd, smbd and samba-ad-dc unconditionally # the init scripts themselves check if they are needed or not match $1 { with start /etc/init.d/nmbd start /etc/init.d/smbd start /etc/init.d/samba-ad-dc start with stop /etc/init.d/samba-ad-dc stop /etc/init.d/smbd stop /etc/init.d/nmbd stop with reload /etc/init.d/smbd reload with restart|force-reload /etc/init.d/nmbd $1 /etc/init.d/smbd $1 /etc/init.d/samba-ad-dc $1 with status setglobal status = '0' setglobal NMBD_DISABLED = $[testparm -s --parameter-name='disable netbios' !2 >/dev/null || true] setglobal SERVER_ROLE = $[samba-tool testparm --parameter-name="server role" !2 >/dev/null | tail -1 || true] if test $SERVER_ROLE != "active directory domain controller" { if test $NMBD_DISABLED != "Yes" { /etc/init.d/nmbd status || setglobal status = $Status } /etc/init.d/smbd status || setglobal status = $Status } else { /etc/init.d/samba-ad-dc status || setglobal status = $Status } exit $status with * echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload|status}" exit 1 }