Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-release-src > by-pkgid > 2c48cf5956b9370979e651dd56ee70db > files > 4

spread-4.1.0-10.mga6.src.rpm

#!/bin/sh
#
# chkconfig: - 79 21
# description: spread daemon start/stop script.
# pidfile: /run/spread/spread.pid
### BEGIN INIT INFO
# Provides: spread
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Short-Description: Multicast Group Communication Framework
# Description: Multicast Group Communication Framework
### END INIT INFO

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

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

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

# Source spread configuration.
if [ -f /etc/sysconfig/spread ] ; then
    . /etc/sysconfig/spread
fi

RETVAL=0

case "$1" in
  start)
	echo -n "Starting spread: "
	/usr/sbin/spread -n $NAME &> /dev/null &
	sleep 2s
	PID=`pidof spread`
	if [ -n "$PID" ]; then
		echo $PID > /run/spread/spread.pid
		touch /var/lock/subsys/spread
		success "spread startup"
	else
		failure "spread startup"
	fi
	RETVAL=$?
	echo
	;;
  stop)
	echo -n "Stopping spread: "
	if [ -r /run/spread/spread.pid ]; then
	    kill -TERM `cat /run/spread/spread.pid`
	    RETVAL=$?
	    [ "$RETVAL" = 0 ] && success "stop" || failure "stop"
	else
	    success "already stopped"
	    RETVAL=0
	fi
	echo
	[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/spread
	[ "$RETVAL" = 0 ] && rm -f /run/spread/spread.pid
	;;
  status)
	status spread
	;;
  restart|reload)
	$0 stop
	$0 start
	;;
  *)
	echo -n  "Usage: spread {start|stop|status|restart|reload}\n"
	RETVAL=1
	;;
esac

exit $RETVAL