Sophie

Sophie

distrib > Mandriva > 2009.0 > x86_64 > media > main-testing-src > by-pkgid > 8e68526eada3a21116ec595769112179 > files > 3

mmc-agent-2.3.2-5mdv2009.0.src.rpm

#!/bin/bash
#
# mmc-agent	This shell script takes care of starting and stopping
#		the Mandriva Management Console agent.
#
# chkconfig: 345 40 60
# description: mmc-agent - Mandriva Management Console agent.
# probe: false
# processname: mmc-agent
# pidfile: /var/run/mmc-agent.pid

# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: mmc-agent
# Required-Start: $network
# Requires-Stop: $network
# Should-Start: ldap
# Should-Stop: ldap
# Default-Start:  3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop mmc-agent
# Description: mmc-agent - Mandriva Management Console agent.
### 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

[ -f /usr/sbin/mmc-agent ] || exit 0

if [ -f /etc/sysconfig/mmc-agent ]; then
    . /etc/sysconfig/mmc-agent
fi

RETVAL=0
start() {
	if [ -n "`/sbin/pidof mmc-agent`" ]; then
	    echo -n "mmc-agent: already running"
	    RETVAL=$?
	    echo
	    return $RETVAL
	fi
        echo -n "Starting mmc-agent: "
        daemon mmc-agent $OPTIONS
        RETVAL=$?
	echo
        [ $RETVAL = 0 ] && touch /var/lock/subsys/mmc-agent
        return $RETVAL
}
stop() {
	echo -n "Stopping mmc-agent: "
	killproc mmc-agent
	RETVAL=$?
	echo
	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/mmc-agent /var/run/mmc-agent.pid
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
        status mmc-agent
	RETVAL=$?
	;;
  restart|reload)
	stop
	start
	;;
  condrestart)
	if [ -f /var/lock/subsys/mmc-agent ] ; then
	    stop
	    start
	fi
	;;
  *)
	echo "Usage: $0 {start|stop|status|restart|condrestart|reload}"
	exit 1
esac

exit $RETVAL