diff options
Diffstat (limited to 'abs/core/runit-scripts/runitscripts/services/xymon-client/run')
-rw-r--r-- | abs/core/runit-scripts/runitscripts/services/xymon-client/run | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/abs/core/runit-scripts/runitscripts/services/xymon-client/run b/abs/core/runit-scripts/runitscripts/services/xymon-client/run new file mode 100644 index 0000000..a454c6b --- /dev/null +++ b/abs/core/runit-scripts/runitscripts/services/xymon-client/run @@ -0,0 +1,60 @@ +#!/bin/sh +export TERM=linux +. /etc/rc.conf +. /etc/rc.d/functions +stat_runit "Starting xymon client" + + + +# Default settings for this client +MACHINEDOTS="`uname -n`" # This systems hostname +SERVEROSTYPE="`uname -s | tr '[ABCDEFGHIJKLMNOPQRSTUVWXYZ/]' '[abcdefghijklmnopqrstuvwxyz_]'`" # This systems operating system in lowercase +XYMONOSSCRIPT="xymonclient-$SERVEROSTYPE.sh" + +# Command-line mods for the defaults +while test "$1" != "" +do + case "$1" in + --hostname=*) + MACHINEDOTS="`echo $1 | sed -e 's/--hostname=//'`" + ;; + --os=*) + SERVEROSTYPE="`echo $1 | sed -e 's/--os=//' | tr '[ABCDEFGHIJKLMNOPQRSTUVWXYZ/]' '[abcdefghijklmnopqrstuvwxyz_]'`" + ;; + --class=*) + CONFIGCLASS="`echo $1 | sed -e 's/--class=//' | tr '[ABCDEFGHIJKLMNOPQRSTUVWXYZ/]' '[abcdefghijklmnopqrstuvwxyz_]'`" + ;; + --help) + echo "Usage: $0 [--hostname=CLIENTNAME] [--os=rhel3|linux22] [--class=CLASSNAME] start|stop" + exit 0 + ;; + start) + CMD=$1 + ;; + stop) + CMD=$1 + ;; + restart) + CMD=$1 + ;; + status) + CMD=$1 + ;; + esac + + shift +done + +XYMONCLIENTHOME="`dirname $0`" +XYMONCLIENTHOME="/data/srv/xymon/client" +export MACHINEDOTS SERVEROSTYPE XYMONOSSCRIPT XYMONCLIENTHOME CONFIGCLASS + +MACHINE="`echo $MACHINEDOTS | sed -e 's/\./,/g'`" +export MACHINE + + +sudo -u nobody MACHINE=$MACHINE XYMONCLIENTHOME=$XYMONCLIENTHOME $XYMONCLIENTHOME/bin/xymonlaunch --config=$XYMONCLIENTHOME/etc/clientlaunch.cfg --log=$XYMONCLIENTHOME/logs/clientlaunch.log --pidfile=$XYMONCLIENTHOME/logs/clientlaunch.$MACHINEDOTS.pid --no-daemon + + + + |