Sophie

Sophie

distrib > Mandriva > 9.1 > i586 > by-pkgid > 92f9f2eb51daee4f9b818b630fd75012 > files > 4

samba3-server-3.0-0.alpha22.2mdk.i586.rpm

#!/bin/sh
#
# chkconfig: 345 81 45
# description: Starts and stops the Samba /usr/sbin/wrepld3 daemon to provide \
# WINS replication services between WINS partner servers.

# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

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

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Check that smb.conf exists.
[ -f /etc/samba3/smb.conf ] || exit 0

RETVAL=0


start() {
	gprintf "Starting WINS Replication services: "
	RETVAL=1
	if [ "`grep -i 'wins partners' /etc/samba3/smb.conf | egrep -v [\#\;]`" ]; then
		daemon /usr/sbin/wrepld3
		RETVAL=$?
	else
		gprintf "WINS replication is not configured in /etc/samba3/smb.conf, not starting\n"
	fi
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys//usr/sbin/wrepld3 || \
	   RETVAL=1
	return $RETVAL
}	
stop() {
	gprintf "Shutting down WINS replication services: "
	RETVAL=1
	if [ "`grep -i 'wins partners' /etc/samba3/smb.conf | egrep -v [\#\;]`" ]; then
		killproc /usr/sbin/wrepld3
		RETVAL=$?
	fi
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys//usr/sbin/wrepld3
	return $RETVAL
}	
restart() {
	stop
	start
}	
reload() {
	export TMPDIR="/var/tmp"
        gprintf "Reloading WINS replication: "
	killproc /usr/sbin/wrepld3 -HUP
	RETVAL=$?
	echo
	return $RETVAL
}	
mdkstatus() {
	status /usr/sbin/wrepld3
}	

case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  restart)
  	restart
	;;
  reload)
  	reload
	;;
  status)
  	mdkstatus
	;;
  condrestart)
  	[ -f /var/lock/subsys//usr/sbin/wrepld3 ] && restart || :
	;;
  *)
	gprintf "Usage: %s {start|stop|restart|status|condrestart}\n" "$0"
	exit 1
esac

exit $?