[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

init.d scripts for Xymon under Ubuntu 8.04 (hardy)



Background:

I'm running Xymon release 4.3.0-0.beta2. Installed via tarball.

I've been trying to adapt the init.d scripts provided with Karmic Koala
(along with the stuff in /etc/hobbit and /usr/share/hobbit/), and I have
Xymon starting (client and server), but for some reason, the bb.html
generated is blank (doesn't list any clients).
I want something more sophisticated than a simple call to hobbit.sh or
runclient.sh, etc., so that's why I'm going with the stuff released in
karmic.

I'm not a super savvy guy script wise, and I'm not fully conversant in how
bb.html is generated (by bbgen)...
Scripts below.

Regards,
Thomas

Note: /etc/hobbit consists of symlinks to files stored in
/home/xymon/server/etc

/etc/init.d/hobbit

#!/bin/sh

# Startup script for the Hobbit monitor
#
# This starts the "hobbitlaunch" tool, which in turn starts
# all of the other Hobbit server programs.

### BEGIN INIT INFO
# Provides:          hobbit
# Required-Start:    $remote_fs $network
# Should-Start:      $all
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Hobbit system monitor server
# Description:       Hobbit system monitor, server part.
#                    (Also monitors the local host.)
### END INIT INFO

PIDFILE=/var/run/hobbit/hobbitlaunch.pid
DAEMON=/home/xymon/server/bin/hobbitlaunch
NAME="hobbitd"
DESC="Hobbit Server"
HOBBITSERVERHOME=/home/xymon/server

test -x $DAEMON || exit 0

. /lib/lsb/init-functions
. /usr/share/hobbit/init-common.sh

# Include hobbitclient defaults if available
if [ -f /etc/default/hobbit-client ] ; then
. /etc/default/hobbit-client
fi

case "$1" in
   "start")
create_includefiles

log_daemon_msg "Starting $DESC" "$NAME"
start-stop-daemon --exec $DAEMON --chuid xymon --umask 022 --start \
-- \
--config=/etc/hobbit/hobbitlaunch.cfg \
--env=/etc/hobbit/hobbitserver.cfg \
--log=$HOBBITSERVERHOME/logs/hobbitlaunch.log \
--pidfile=$PIDFILE
log_end_msg $?
;;

   "stop")
log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --exec $DAEMON --pidfile $PIDFILE --stop --retry 5
log_end_msg $?
;;

   "status")
if test -s $PIDFILE
then
kill -0 `cat $PIDFILE`
if test $? -eq 0
then
echo "Hobbit (hobbitlaunch) running with PID `cat $PIDFILE`"
exit 0
else
echo "Hobbit not running, removing stale PID file"
rm -f $PIDFILE
exit 1
fi
else
echo "Hobbit (hobbitlaunch) does not appear to be running"
exit 3
fi
;;

   "restart")
if test -s $PIDFILE
then
$0 stop
sleep 1
$0 start
else
log_action_msg "hobbitlaunch does not appear to be running, starting it"
$0 start
fi
;;

   "reload"|"force-reload")
if test -s $PIDFILE
then
create_includefiles
log_action_msg "Reloading hobbitd config"
kill -HUP `cat /var/run/hobbit/hobbitd.pid`
else
log_action_msg "hobbitd not running (no PID file)"
fi
;;

   "rotate")
for PIDFILE in /var/run/hobbit/*.pid
do
test -e $PIDFILE && kill -HUP `cat $PIDFILE`
done
;;

   *)
   echo "Usage: $0 start|stop|restart|force-reload|reload|status|rotate"
break;
esac

exit 0