45 lines
1.2 KiB
Bash
45 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
# carp_exporter/files/carp_exporter.in 2021-08-20 09:12:03Z yo $
|
|
#
|
|
# PROVIDE: carp_exporter
|
|
# REQUIRE: DAEMON
|
|
# KEYWORD: shutdown
|
|
#
|
|
# carp_exporter_enable (bool): Set to "YES" to enable carp_exporter.
|
|
# (default: "NO")
|
|
#
|
|
# carp_exporter_listen (str): Exporter listening address - NOT IMPLEMENTED
|
|
# (default: ":8992")
|
|
#
|
|
# carp_exporter_logfile (str): carp_exporter logfile
|
|
# (default: "/var/log/carp_exporter.log")
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=carp_exporter
|
|
rcvar=carp_exporter_enable
|
|
|
|
load_rc_config $name
|
|
|
|
: ${carp_exporter_enable="NO"}
|
|
: ${carp_exporter_listen=":8992"}
|
|
: ${carp_exporter_pidfile:="/var/run/carp_exporter.pid"}
|
|
: ${carp_exporter_user:="nobody"}
|
|
: ${carp_exporter_logfile="/var/log/carp_exporter.log"}
|
|
|
|
command="python3"
|
|
command_args="/usr/local/bin/carp_exporter.py > ${carp_exporter_logfile} 2>&1"
|
|
start_cmd="/usr/sbin/daemon -u ${carp_exporter_user} -p ${carp_exporter_pidfile} ${command} ${command_args}"
|
|
start_precmd="${name}_prestart"
|
|
|
|
carp_exporter_prestart()
|
|
{
|
|
touch ${carp_exporter_logfile}
|
|
chown ${carp_exporter_user} ${carp_exporter_logfile}
|
|
}
|
|
|
|
|
|
run_rc_command "$1"
|