Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > c2b4a5324d269e802be4f7b077110d76 > files > 8

centreon-2.0-4mdv2010.0.noarch.rpm

#!/bin/sh

### BEGIN INIT INFO
# Provides: centstorage
# Required-Start:
# Required-Stop:
# Default-Start:  3 5
# Default-Stop: 0 1 6
# Description: Start the centreon storage collector
### END INIT INFO

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

CFGFILE=/etc/centreon/conf.pm
BINFILE=/usr/share/centreon/bin/centstorage
LOGFILE=/var/log/centreon/centstorage.log
LOCKFILE=/var/lock/subsys/centreon-storage

start() {
    if [ ! -f $LOCKFILE ]; then
	gprintf "Starting centstorage:"
	daemon --user nagios "$BINFILE >> $LOGFILE 2>&1"
	rc=$?
	echo
	[ $rc -eq 0 ] && touch $LOCKFILE
	return $rc
    fi
}

stop() {
    gprintf "Stopping centstorage:"
    killproc centstorage
    rc=$?
    echo
    [ $rc -eq 0 ] && rm -f $LOCKFILE
    return $rc
}

reload() {
    gprintf "Reloading centstorage:"
    killproc centstorage -HUP
    rc=$?
    echo
    return $rc
}

if [ ! -f $CFGFILE ]; then
    gprintf "Configuration file %s not found.  Exiting.\n" "$CFGFILE"
    exit 1
fi
          
# See how we were called.
case "$1" in
    start)
	start
	;;
    
    stop)
	stop
	;;
    
    status)
	status centstorage
	;;
    
    restart)
	stop
	start
	;;

    reload)
	reload
	;;
    
    *)
	gprintf "Usage: %s {start|stop|restart|reload|status}\n" "$0"
	exit 1
	;;
esac