#!/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 setvar status = '0' setvar NMBD_DISABLED = $(testparm -s --parameter-name='disable netbios' 2>/dev/null || true) setvar 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 || setvar status = "$Status" } /etc/init.d/smbd status || setvar status = "$Status" } else { /etc/init.d/samba-ad-dc status || setvar status = "$Status" } exit $status with * echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload|status}" exit 1 }