New argusd startup script
dan1
dan1 at edenpics.com
Tue Nov 15 10:24:38 EST 2005
Hello.
I have changed a bit the current argusd file so that it fits for RedHat 8,9,
RHEL likes systems (CentOS 3+4, ubuntu, and so forth).
It seems to be working well. Could you put that in the distribution ? If you
do, please don't mention my e-mail.
The name of the script is argusd as it is more common to type 'service
argusd start'. It allows a restart, querying the status, adds a nice [OK]
message when ok, and also uses a lockfile so that only one instance can run.
I don't know if that is a bad idea, but I think it is ok to my point of
view.
It also allows to use the 'chkconfig' program to turn the service on and off
at boot-up.
Hope this helps a bit the others.
Best regards,
Daniel
/etc/rc.d/init.d/argusd
--------------------------------
#!/bin/bash
# Argus
# chkconfig: - 88 12
# description: Argus is a tcp/udp monitoring program that allows you to
watch \
# the status of several servers and report it as HTML pages.
# processname: argusd
# config: /var/argus/config
# pidfile: /var/run/argusd.pid
# Copyright (c) 2002 by Jeff Weisberg
# Author: Jeff Weisberg <argus @ tcp4me.com>
# Date: 2002-Jun-21 18:43 (EDT)
# Function: argusd startup rc script
# $Id: rc.argusd,v 1.5 2002/11/19 23:42:07 jaw Exp $
# Source function library.
. /etc/rc.d/init.d/functions
prog=argusd
lockfile=/var/lock/subsys/$prog
RETVAL=0;
start() {
# ulimit does not have a standard/portable syntax
# if you need more file descriptors, put the command here
# eg: ulimit -n 1000
# since rc files normally run as root, and
# you may not want argus running as root,
# to run argus as a certain user or group
# add -u user and/or -g group below
if [ ! -f /var/lock/subsys/$prog ]; then
echo -n $"Starting $prog: "
/usr/local/sbin/argusd
RETVAL=$?
if [ $RETVAL = 0 ]; then
echo -n " [ "
echo -en '\E[;32m'"\033[1mOK\033[0m"
echo " ]"
[ $RETVAL -eq 0 ] && touch $lockfile
else
echo -n " ["
echo -en '\E[;31m'"\033[1mFailed\033[0m"
echo "]"
fi
else
echo "Argus is already running..."
fi
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
/usr/local/sbin/argusctl shutdown reason="argusd stop"
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $lockfile
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status argusd
RETVAL=$?
exit $RETVAL;
;;
*)
echo usage: $0 'start|stop|restart|status'
RETVAL=1
;;
esac
exit $RETVAL
More information about the Arguslist
mailing list