Sophie

Sophie

distrib > Mandriva > 2010.2 > x86_64 > by-pkgid > bdc3a9aac224f3f2467d8d1a1f7330e0 > files > 9

centreon-2.0-4mdv2010.1.src.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
	echo -n "Starting centstorage:"
	daemon --user nagios "$BINFILE >> $LOGFILE 2>&1"
	rc=$?
	echo
	[ $rc -eq 0 ] && touch $LOCKFILE
	return $rc
    fi
}

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

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

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

    reload)
	reload
	;;
    
    *)
	echo "Usage: $0 {start|stop|restart|reload|status}"
	exit 1
	;;
esac