2010-06-07 03:36:45 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# **********************************************************************
|
|
|
|
# Pandora FMS Agent Daemon launcher for FreeBSD
|
|
|
|
# (c) 2010 Junichi Satoh <junichi@rworks.jp>
|
|
|
|
#
|
|
|
|
# **********************************************************************
|
|
|
|
|
|
|
|
# PROVIDE: pandora_agent
|
|
|
|
# REQUIRE: LOGIN
|
|
|
|
# KEYWORD: shutdown
|
|
|
|
|
|
|
|
# Add the following line to /etc/rc.conf to enable `pandora_agent':
|
|
|
|
#
|
|
|
|
# pandora_agent_enable="YES"
|
|
|
|
#
|
|
|
|
|
|
|
|
. "/etc/rc.subr"
|
|
|
|
|
|
|
|
name="pandora_agent"
|
2010-07-05 03:56:19 +02:00
|
|
|
rcvar=`set_rcvar`
|
2010-06-07 03:36:45 +02:00
|
|
|
|
|
|
|
# read configuration and set defaults
|
|
|
|
pandora_agent_enable=${pandora_agent_enable:-"NO"}
|
|
|
|
load_rc_config "$name"
|
|
|
|
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
|
|
|
|
|
|
|
|
command=/usr/local/bin/pandora_agent
|
|
|
|
command_args="/usr/local/etc/pandora &"
|
|
|
|
|
|
|
|
pidfile=/var/run/$name.pid
|
|
|
|
required_files="/usr/local/etc/pandora/pandora_agent.conf"
|
|
|
|
start_postcmd=start_postcmd
|
2010-07-05 03:56:19 +02:00
|
|
|
stop_postcmd=stop_postcmd
|
2010-06-07 03:36:45 +02:00
|
|
|
|
2010-07-05 03:56:19 +02:00
|
|
|
procname="/usr/bin/perl"
|
2010-06-07 03:36:45 +02:00
|
|
|
|
|
|
|
start_postcmd()
|
|
|
|
{
|
2010-07-05 03:56:19 +02:00
|
|
|
sleep 1
|
2010-09-27 04:06:34 +02:00
|
|
|
PANDORA_PID=`pgrep -f -j none $name`
|
2010-06-07 03:36:45 +02:00
|
|
|
echo $PANDORA_PID > $pidfile
|
|
|
|
}
|
|
|
|
|
2010-07-05 03:56:19 +02:00
|
|
|
stop_postcmd()
|
2010-06-07 03:36:45 +02:00
|
|
|
{
|
2010-07-05 03:56:19 +02:00
|
|
|
rm -f $pidfile
|
2010-06-07 03:36:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
run_rc_command "$1"
|