[csw-users] CSWnrpe start/stop method

Roman Klesel roman.klesel at googlemail.com
Fri Feb 16 09:27:42 CET 2007


Hello,

I'm using the CSWnrpe package from the unstable branch. The start/stop
method in /opt/csw/lib/svc/method/svc-nrpe I found is no good.

It does not take zones into account and it does not use the right UIDs.

I changed it to look like this:

#!/sbin/sh
#
# Copyright (c) 1992 - 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident  "@(#)nrpe       1.19    01/12/05 SMI"
# Modified for CSW by Alex Moore 2005-12-03

CONFIG_FILE=/etc/opt/csw/nrpe.cfg
if [ ! -f $CONFIG_FILE ] ; then
    CONFIG_FILE=/opt/csw/etc/nrpe.cfg
fi
BIN_FILE="/opt/csw/bin/nrpe"

case "$1" in
'restart')
        ZONE_NAME=`zonename`
        [ -n "`pgrep -x -u nagios -z $ZONE_NAME nrpe`" ] && kill -TERM
`pgrep -x -u nagios -z $ZONE_NAME nrpe`
        if [ -f $CONFIG_FILE ]; then
            wait 1
            $BIN_FILE -c $CONFIG_FILE -d
        fi
        ;;

'start')
        if [ -f $CONFIG_FILE ]; then
            $BIN_FILE -c $CONFIG_FILE -d
        fi
        ;;

'stop')
        ZONE_NAME=`zonename`
        [ -n "`pgrep -x -u nagios -z $ZONE_NAME nrpe`" ] && kill -TERM
`pgrep -x -u nagios -z $ZONE_NAME nrpe`
        ;;

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


Maybe you would like implement the changes into the package?

Nevertheless, thanks for keeping up this nice service!

Greetings Roman



More information about the users mailing list