1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

Execute the xymonlaunch process directly. The supplied runclient.sh

script duplicates much of the rc script and adds unnecessary complexity.

While here ensure that leftover processes are cleaned up.

This also fixes a recent regression which prevented xymon-client from
reliably starting on boot.

PR:		197827
This commit is contained in:
Mark Felder 2015-02-21 16:50:30 +00:00
parent ae2170cacf
commit 5763e8cdb9
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=379535
2 changed files with 43 additions and 5 deletions

View File

@ -2,7 +2,7 @@
PORTNAME= xymon
PORTVERSION= 4.3.18
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= net-mgmt www
MASTER_SITES= SF/xymon/Xymon/${PORTVERSION}
PKGNAMESUFFIX= -client${PKGNAMESUFFIX2}

View File

@ -16,10 +16,48 @@ load_rc_config "$name"
: ${xymon_client_enable:=NO}
: ${xymon_client_user:=%%XYMONUSER%%}
command=%%WWWDIR%%/client/runclient.sh
command_args="${xymon_client_flags} ${1}"
procname=%%WWWDIR%%/client/bin/xymonlaunch
pidfile="%%WWWDIR%%/client/logs/clientlaunch.`hostname`.pid"
start_precmd="chown -R ${xymon_client_user} %%WWWDIR%%/client/logs"
command=%%WWWDIR%%/client/bin/xymonlaunch
command_args="--config=%%WWWDIR%%/client/etc/clientlaunch.cfg --log=%%WWWDIR%%/client/logs/clientlaunch.log --pidfile=${pidfile}"
start_precmd=xymon_precmd
# Clean up leftover children
stop_postcmd="pkill -U ${xymon_client_user}"
xymon_precmd()
{
# Don't actually pass $xymon_client_flags to $command
rc_flags=""
# Ensure permissions of log dir
chown -R ${xymon_client_user} %%WWWDIR%%/client/logs
# Below is pulled almost directly from Xymon's runclient.sh script which we are bypassing due to redundancy
# Default settings for this client
MACHINEDOTS="`uname -n`"
SERVEROSTYPE="`uname -s | tr '[ABCDEFGHIJKLMNOPQRSTUVWXYZ/]' '[abcdefghijklmnopqrstuvwxyz_]'"`
XYMONOSSCRIPT="xymonclient-$SERVEROSTYPE.sh"
XYMONCLIENTHOME="%%WWWDIR%%/client"
for i in $xymon_client_flags; do
case "$i" in
--hostname=*)
MACHINEDOTS="`echo $i | sed -e 's/--hostname=//'`"
;;
--os=*)
SERVEROSTYPE="`echo $i | sed -e 's/--os=//' | tr '[ABCDEFGHIJKLMNOPQRSTUVWXYZ/]' '[abcdefghijklmnopqrstuvwxyz_]'`"
;;
--class=*)
CONFIGCLASS="`echo $i | sed -e 's/--class=//' | tr '[ABCDEFGHIJKLMNOPQRSTUVWXYZ/]' '[abcdefghijklmnopqrstuvwxyz_]'`"
;;
esac
shift
done
export MACHINEDOTS SERVEROSTYPE XYMONOSSCRIPT XYMONCLIENTHOME CONFIGCLASS
MACHINE="`echo $MACHINEDOTS | sed -e 's/\./,/g'`"
export MACHINE
}
run_rc_command "$1"