#!/bin/bash
# Samba 4
#
# chkconfig: 35 99 2
# description: Provides Active Directory Services
### BEGIN INIT INFO
# Provides: samba
# Required-Start: $network
# Default-Stop: 0 1 2 6
# Default-Start: 3 5
# Short-Description: Provides Active Directory Services
# Description: Provides Active Directory Services
### END INIT INFO
# version 1.0
# Source function library
. /etc/rc.d/init.d/functions
PID="/usr/local/samba/var/run/samba.pid"
RETVAL=0
check() {
# Check that we're a privileged user
[ "`id -u`" = 0 ] || exit 4
}
start () {
check
/usr/local/samba/sbin/samba
RETVAL=$?
return $RETVAL
}
stop () {
check
kill `cat $PID`
RETVAL=$?
return $RETVAL
}
restart () {
stop
sleep 10
start
}
reload() {
restart
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart|reload}"
RETVAL=2
esac
exit $RETVAL