Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > media > contrib-release > by-pkgid > 4a0f21d8352624b9735ac5f423a3f48a > files > 8

hobbit-client-4.2.0-1mdv2007.0.i586.rpm

#! /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=/usr/lib/hobbit/client/runclient.sh
NAME=hobbit-client
DESC=hobbit-client

test -x $DAEMON || exit 0

CMD="$1"

# Include hobbit-client defaults if available
DMNOPTS=""
if [ -f /etc/sysconfig/hobbit-client ] ; then
	. /etc/sysconfig/hobbit-client
else
	echo "Installation failure - missing /etc/sysconfig/hobbit-client"
	exit 1
fi

if [ "$HOBBITSERVERS" = "" ]; then
	echo "Please configure HOBBITSERVERS in /etc/sysconfig/hobbit-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 - hobbit -c "$DAEMON $DMNOPTS start"
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	su - hobbit -c "$DAEMON stop"
	echo "$NAME."
	;;
  restart)
	echo -n "Restarting $DESC: "
	su - hobbit -c "$DAEMON stop"
	su - hobbit -c "$DAEMON $DMNOPTS start"
	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