File munin-node.rc of Package munin

#!/bin/sh
#
# munin-node	Control the Munin Node Server (formerly Linpro RRD client)
#
# Author: Rune Nordbe Skillingstad <runesk@linpro.no>
#
### BEGIN INIT INFO
# Provides: munin-node
# Required-Start: $network $remote_fs
# Required-Stop: $null
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
# Short-Description: Network-wide graphing framework (node)
# Description:    Munin Node Agents
### END INIT INFO

# Source SuSE config
. /etc/rc.status

MUNIN_BIN=/usr/sbin/munin-node
test -x $MUNIN_BIN || exit 5

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status

# First reset status of this service
rc_reset

# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - misc error
# 2 - invalid or excess args
# 3 - unimplemented feature (e.g. reload)
# 4 - insufficient privilege
# 5 - program not installed
# 6 - program not configured
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.

# See how we were called.
case "$1" in
  start)
	echo -n "Starting Munin Node: "
	if [ ! -d /var/run/munin ]; then
	    mkdir -p /var/run/munin 2>/dev/null
	    chown munin /var/run/munin
	fi

	## Start daemon with startproc(8). If this fails
        ## the echo return value is set appropriate.
	startproc $MUNIN_BIN

	# Remember status and be verbose
        rc_status -v
	;;
  stop)
	echo -n "Stopping Munin Node agents: "
       ## Stop daemon with killproc(8) and if this fails
        ## set echo the echo return value.

        killproc -TERM $MUNIN_BIN

        # Remember status and be verbose
        rc_status -v
	;;
  restart|reload)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        $0 start

        # Remember status and be quiet
        rc_status
        ;;
  status)
        echo -n "Checking for Munin Node: "
        checkproc $MUNIN_BIN
        rc_status -v
        ;;
  *)
	echo "Usage: $0 {start|stop|status|restart}"
	exit 1
esac
rc_exit
openSUSE Build Service is sponsored by