blob: a5d7c6c0ffa81088194d546178377e41f378f5bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: xymon_client
# REQUIRE: DAEMON
# KEYWORD: shutdown
. /etc/rc.subr
name=xymon_client
rcvar=xymon_client_enable
load_rc_config "$name"
: ${xymon_client_enable:=NO}
: ${xymon_client_user:=%%XYMONUSER%%}
pidfile="%%WWWDIR%%/client/logs/clientlaunch.`hostname`.pid"
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
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"
|