RHEL6 init.d script (was Re: Initscript Debian Wheezy)

Marc Muehlfeld Marc.Muehlfeld at medizinische-genetik.de
Mon Sep 3 12:48:31 MDT 2012


Hi,

if you want, you can publish my RHEL6/SL6/Centos6 init.d script, too and 
replace the one in the wiki.

It uses the RH functions, so you get a nice green [OK] or red [FAILED], and 
can be de-/activated with 'chkconfig rc.samba4 on|off'.

Regards,
Marc


-- 
Marc Muehlfeld (IT-Leiter)
Zentrum für Humangenetik und Laboratoriumsmedizin
Dr. Klein, Dr. Rost und Kollegen
Lochhamer Str. 29 - D-82152 Martinsried
Telefon: +49(0)89/895578-0 - Fax: +49(0)89/895578-780
http://www.medizinische-genetik.de
-------------- next part --------------
#!/bin/bash
#
# samba4	This shell script takes care of starting and stopping
#		samba4 daemons.
#
# chkconfig: - 58 74
# description: Samba 4.0 will be the next version of the Samba suite
# and incorporates all the technology found in both the Samba4 alpha
# series and the stable 3.x series. The primary additional features
# over Samba 3.6 are support for the Active Directory logon protocols
# used by Windows 2000 and above. 

### BEGIN INIT INFO
# Provides: samba4
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Should-Start: $syslog $named
# Should-Stop: $syslog $named
# Short-Description: start and stop samba4
# Description: Samba 4.0 will be the next version of the Samba suite
# and incorporates all the technology found in both the Samba4 alpha
# series and the stable 3.x series. The primary additional features
# over Samba 3.6 are support for the Active Directory logon protocols
# used by Windows 2000 and above. 
### END INIT INFO

# Source function library.
. /etc/init.d/functions


# Source networking configuration.
. /etc/sysconfig/network


prog=samba
prog_dir=/usr/local/samba/sbin/
lockfile=/var/lock/subsys/$prog


start() {
	[ "$NETWORKING" = "no" ] && exit 1
	[ -x /usr/sbin/ntpd ] || exit 5

        # Start daemons.
        echo -n $"Starting samba4: "
        daemon $prog_dir/$prog -D
	RETVAL=$?
        echo
	[ $RETVAL -eq 0 ] && touch $lockfile
	return $RETVAL
}


stop() {
	[ "$EUID" != "0" ] && exit 4
        echo -n $"Shutting down samba4: "
	killproc $prog_dir/$prog
	RETVAL=$?
        echo
	[ $RETVAL -eq 0 ] && rm -f $lockfile
	return $RETVAL
}


# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
	status $prog
	;;
  restart)
	stop
	start
	;;
  reload)
	echo "Not implemented yet."
	exit 3
	;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|reload}"
	exit 2
esac


More information about the samba-technical mailing list