Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37563827
en ru br
ALT Linux repositórios
S:4.3.30-alt2

Group :: Monitoramento
RPM: xymon

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

#!/bin/sh
#
# xymon client init.d script.
#
#----------------------------------------------------------------------------#
# This invokes xymonlaunch, which in turn runs the Xymon client and any #
# extensions configured. #
# #
# Copyright (C) 2005-2010 Henrik Storner <henrik@hswn.dk> #
# #
# Integration of runclient.sh and xymon-client.initd by Japheth Cleaver 2011 #
# Rewrote init script for ALT Linux by Sergey Y. Afonin 2013 #
# #
# This program is released under the GNU General Public License (GPL), #
# version 2. See the file "COPYING" for details. #
# #
#----------------------------------------------------------------------------#
#
# chkconfig: - 80 20
# description: Xymon is a network monitoring tool that can monitor hosts \
# and services. The client reports local system statistics \
# (cpu, memory, disk, etc) to Xymon server.
#
# processname: xymonlaunch
# pidfile: @XYMONRUNDIR@/xymonlaunch.pid
# config: @XYMONTOPDIR@/client/etc/xymonclient.cfg
# config: @XYMONTOPDIR@/client/etc/clientlaunch.cfg autoreload
#
### BEGIN INIT INFO
# Provides: xymon-client
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Short-Description: start and stop the xymon client
# Description: Xymon is a network monitoring tool that can monitor hosts
# and services. The client reports local system statistics
# (cpu, memory, disk, etc) to Xymon server.
### END INIT INFO

# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1

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

USER=@XYMONUSER@
DAEMON=xymonlaunch
RUNPATH=/usr/bin
LOCKFILE=/var/lock/subsys/$DAEMON
XYMONCLIENTHOME="@XYMONTOPDIR@/client"
RETVAL=0

# Default settings for this client
MACHINEDOTS="`uname -n`" # This system's hostname
SERVEROSTYPE="`uname -s | tr '[A-Z/]' '[a-z_]'`" # This system's operating system in lowercase
CONFIGCLASS="" # This system's config class

# Source config files
. /etc/sysconfig/xymon-client

# Check for overrides from /etc/sysconfig/xymon-config
[ -n "$CLIENTHOSTNAME" ] && MACHINEDOTS="$CLIENTHOSTNAME"
[ -n "$CLIENTOS" ] && SERVEROSTYPE="$CLIENTOS"
[ -n "$CLIENTCLASS" ] && CONFIGCLASS="$CLIENTCLASS"

MACHINE="`echo $MACHINEDOTS | sed -e 's/\./,/g'`"
XYMONOSSCRIPT="xymonclient-${SERVEROSTYPE}.sh"
XYMONLAUNCHOPTS="$XYMONLAUNCHOPTS"

export MACHINE MACHINEDOTS SERVEROSTYPE XYMONOSSCRIPT XYMONLAUNCHOPTS XYMONCLIENTHOME CONFIGCLASS

# Values used in the remainder of the initscript
envfile="@XYMONTOPDIR@/client/etc/xymonclient.cfg"
configfile="@XYMONTOPDIR@/client/etc/clientlaunch.cfg"
logfile="@XYMONLOGDIR@/xymonlaunch.log"
pidfile="@XYMONRUNDIR@/xymonlaunch.pid"

# Check to make sure our pidfile's directory exists
rundir="`dirname $pidfile`"
[ -d "$rundir" ] || install -d -o "$user" -g "$user" "$rundir" || exit 1

start()
{
start_daemon --pidfile "$pidfile" --lockfile "$LOCKFILE" --expect-user $USER --user $USER -- $RUNPATH/$DAEMON \
$XYMONLAUNCHOPTS --env=$envfile --config=$configfile --log=$logfile --pidfile=$pidfile
RETVAL=$?
return $RETVAL
}

stop()
{
stop_daemon --pidfile "$pidfile" --lockfile "$LOCKFILE" --expect-user $USER -- $RUNPATH/$DAEMON
RETVAL=$?
return $RETVAL
}

restart()
{
stop
start
}

reload()
{
msg_reloading $DAEMON
stop_daemon --pidfile "$pidfile" --expect-user $USER -HUP -- $RUNPATH/$DAEMON
RETVAL=$?
return $RETVAL
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
condstop)
if [ -e "$LOCKFILE" ]; then
stop
fi
;;
condrestart)
if [ -e "$LOCKFILE" ]; then
restart
fi
;;
condreload)
if [ -e "$LOCKFILE" ]; then
reload
fi
;;
status)
status --pidfile "$pidfile" --expect-user $USER -- $RUNPATH/$DAEMON
RETVAL=$?
;;
rotate)
cat $rundir/*.pid 2>/dev/null | xargs -r kill -HUP
;;
*)
msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status|rotate}"
RETVAL=1
esac

exit $RETVAL
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009