Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 4285d969b1b970965b1378e0feae69e1 > files > 3

sympa-6.1.4-2.3.mga1.src.rpm

#!/bin/sh
#
# chkconfig: 345 95 05

### BEGIN INIT INFO
# Provides: sympa
# Required-Start: $network mysql
# Required-Stop: $network
# Default-Start: 345
# Short-Description: sympa list manager
# Description: This startup script manages the sympa list manager
### 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

# Local variables
NAME=sympa
LOCKFILE=/var/lock/subsys/$NAME

start() {
    # Check if it is already running
    if [ ! -f $LOCKFILE ]; then
	rc=0
	for module in sympa bulk archived bounced task_manager; do
	    echo -n "Starting $module:" 
	    daemon --pidfile /var/run/sympa/$module.pid "/usr/sbin/$module.pl 2>/dev/null"
	    rc=$(($rc + $?))
	    echo
	done

	if [ $rc -eq 0 ]; then
	    # everything OK
	    touch $LOCKFILE
	fi
    else
	echo "$NAME is already running"
    fi
}

stop() {
    rc=0
    for module in bounced archived bulk sympa sympa-distribute \
	sympa-creation task_manager; do
	if [ -f /var/run/sympa/$module.pid ]; then
	    echo -n "Stopping $module:" 
	    killproc -p /var/run/sympa/$module.pid $module.pl
	    rc=$(($rc + $?))
	    echo
	fi
    done

    if [ $rc -eq 0 ]; then
	rm -f $LOCKFILE
    fi
}

restart() {
    stop
    start
}

# See how we were called.
case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    restart|reload)
	restart
	;;
    condrestart|condreload)
	if [ -f $LOCKFILE ]; then
	    restart
	fi
	;;
    status)
	for module in sympa bulk archived bounced task_manager; do
	    status -p /var/run/sympa/$module.pid $module.pl
	done
	;;
    *)
	echo "Usage: $0 {start|stop|status|restart}"
	RETVAL=1
	;;
esac

exit $RETVAL