66 lines
1.8 KiB
Bash
Executable File
66 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# **********************************************************************
|
|
# Pandora FMS Server Daemon launcher through pandora_ha for FreeBSD
|
|
# (c) 2010-2021 Junichi Satoh <junichi@rworks.jp>
|
|
# (c) 2014 Koichiro Kikuchi <koichiro@rworks.jp>
|
|
#
|
|
# **********************************************************************
|
|
|
|
# PROVIDE: pandora_server
|
|
# REQUIRE: LOGIN mysql
|
|
# KEYWORD: shutdown
|
|
|
|
# Add the following lines to /etc/rc.conf to enable pandora_server:
|
|
# pandora_server_enable (bool): Set to "YES" to enable pandora_server (default: NO)
|
|
#
|
|
|
|
. "/etc/rc.subr"
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
|
|
|
|
name="pandora_ha"
|
|
rcvar=pandora_server_enable
|
|
|
|
: ${pandora_server_enable:=NO}
|
|
: ${pandora_server_configfile:=/usr/local/etc/pandora/pandora_server.conf}
|
|
|
|
command=/usr/local/bin/pandora_ha
|
|
command_pandora=/usr/local/bin/pandora_server
|
|
command_interpreter=/usr/local/bin/perl
|
|
_pidprefix=/var/run/pandora_ha
|
|
_pidprefix_pandora=/var/run/pandora_server
|
|
pidfile=${_pidprefix}.pid
|
|
pidfile_pandora=${_pidprefix_pandora}.pid
|
|
required_files="$pandora_server_configfile"
|
|
extra_commands="status_server start_server stop_server restart_server"
|
|
|
|
stop_postcmd=stop_postcmd
|
|
|
|
status_server_cmd=control_pandora_server
|
|
start_server_cmd=control_pandora_server
|
|
stop_server_cmd=control_pandora_server
|
|
restart_server_cmd=control_pandora_server
|
|
|
|
load_rc_config $name
|
|
|
|
control_pandora_server() {
|
|
local name command pidfile
|
|
name="pandora_server"
|
|
command=$command_pandora
|
|
pidfile=$pidfile_pandora
|
|
pandora_server_flags="-D $pandora_server_flags -P $pidfile_pandora $pandora_server_configfile"
|
|
pandora_arg=`echo $rc_arg | sed 's/_server//g'`
|
|
unset "${pandora_arg}_cmd" "${pandora_arg}_precmd" "${pandora_arg}_postcmd"
|
|
run_rc_command $pandora_arg
|
|
}
|
|
|
|
stop_postcmd()
|
|
{
|
|
rm -f $pidfile
|
|
}
|
|
|
|
pandora_ha_flags="-d -p $pidfile $pandora_server_configfile"
|
|
|
|
run_rc_command "$1"
|