RC Style Start/Stop for netsaint_statd (remote system stats)

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
twebster
Posts: 27
Joined: Wed Dec 18, 2002 9:58 am

RC Style Start/Stop for netsaint_statd (remote system stats)

Post by twebster »

Below is a rc style script to start/stop the netsaint_statd daemon that I is used for grabbing remote statistics.
The netsaint_statd is available at http://www.raxnet.net/downloads/scripts ... int.tar.gz

Other related posts are:
http://raxnet.net/board/viewtopic.php?t=624
http://www.raxnet.net/board/viewtopic.php?p=2131#2131

I will also post this message in the first of the above links for later reference.

I used this on RedHat, placed in the /etc/init.d directory.

twebster


#!/bin/sh
#
# processname: netsaint_statd
# pidfile: /var/run/netsaint_statd.pid
# lockfile: /var/lock/subsys/netsaint_statd

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

EXEC="/usr/local/bin/netsaint_statd"

[ -f $EXEC ] || exit 0

RETVAL=0
prog="netsaint_statd"

start() {
# Start daemons.

echo -n $"Starting $prog: "


# Start up netsaint_statd daemon so netsaint can monitor disk usages, etc...

if [ -f $EXEC ]; then
daemon $EXEC
fi

RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/netsaint_statd
return $RETVAL
}

stop() {
# Stop daemons.
echo -n $"Shutting down $prog: "
killproc netsaint_statd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/netsaint_statd
return $RETVAL
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/netsaint_statd ]; then
stop
start
RETVAL=$?
fi
;;
status)
status netsaint_statd
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac

exit $RETVAL[/url]
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest