#! /bin/sh # # hobbit-client This shell script takes care of starting and stopping # the hobbit client. # # chkconfig: 2345 80 20 # description: hobbit is a network monitoring tool that allows \ # you to monitor hosts and services. This client reports local \ # system statistics (cpu-, memory-, disk-utilisation etc) \ # to the Hobbit server. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/home/xymon/client/runclient.sh NAME=xymon-client DESC=xymon-client test -x $DAEMON || exit 0 CMD="$1" # Include hobbit-client defaults if available DMNOPTS="" if [ -f /etc/default/xymon-client ] ; then . /etc/default/xymon-client #else # echo "Installation failure - missing /etc/default/xymon-client" # exit 1 fi if [ "$HOBBITSERVERS" = "" ]; then echo "Please configure HOBBITSERVERS in /etc/default/xymon-client" exit 1 fi set $HOBBITSERVERS if [ $# -eq 1 ]; then echo "BBDISP=\"$HOBBITSERVERS\"" >/var/run/hobbitclient-runtime.cfg echo "BBDISPLAYS=\"\"" >>/var/run/hobbitclient-runtime.cfg else echo "BBDISP=\"0.0.0.0\"" >/var/run/hobbitclient-runtime.cfg echo "BBDISPLAYS=\"$HOBBITSERVERS\"" >>/var/run/hobbitclient-runtime.cfg fi if [ "$CLIENTHOSTNAME" != "" ]; then DMNOPTS="${DMNOPTS} --hostname=${CLIENTHOSTNAME}" fi if [ "$CLIENTOS" != "" ]; then DMNOPTS="${DMNOPTS} --os=${CLIENTOS}" fi set -e case "$CMD" in start) echo -n "Starting $DESC: " su -c "$DAEMON $DMNOPTS start" - "$NAME" echo "$NAME." ;; stop) echo -n "Stopping $DESC: " su -c "$DAEMON stop" - "$NAME" echo "$NAME." ;; restart) echo -n "Restarting $DESC: " su -c "$DAEMON stop" - "$NAME" su -c "$DAEMON $DMNOPTS start" - "$NAME" echo "$NAME." ;; *) N=/etc/init.d/$NAME # echo "Usage: $N {start|stop|restart}" >&2 echo "Usage: $N {start|stop|restart}" >&2 exit 1 ;; esac exit 0