mirror of
https://git.freebsd.org/ports.git
synced 2025-06-20 20:20:30 -04:00
54 lines
1.6 KiB
Bash
54 lines
1.6 KiB
Bash
#!/bin/sh
|
|
|
|
# $FreeBSD$
|
|
#
|
|
# PROVIDE: phpfpm_exporter
|
|
# REQUIRE: LOGIN
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
|
# to enable this service:
|
|
#
|
|
# phpfpm_exporter_enable (bool): Set to NO by default.
|
|
# Set it to YES to enable phpfpm_exporter.
|
|
# phpfpm_exporter_user (string): Set user that phpfpm_exporter will run under
|
|
# Default is "nobody".
|
|
# phpfpm_exporter_group (string): Set group that phpfpm_exporter will run under
|
|
# Default is "nobody".
|
|
# phpfpm_exporter_endpoint (string): Set status endpoint
|
|
# Default is "http://127.0.0.1:9000/status".
|
|
# phpfpm_exporter_listen_address (string): Set ip:port that phpfpm_exporter will listen on
|
|
# Default is "127.0.0.1:8080".
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=phpfpm_exporter
|
|
rcvar=phpfpm_exporter_enable
|
|
|
|
load_rc_config $name
|
|
|
|
: ${phpfpm_exporter_enable:="NO"}
|
|
: ${phpfpm_exporter_user:="nobody"}
|
|
: ${phpfpm_exporter_group:="nobody"}
|
|
: ${phpfpm_exporter_endpoint:="http://127.0.0.1:9000/status"}
|
|
: ${phpfpm_exporter_listen_address:="127.0.0.1:8080"}
|
|
|
|
|
|
pidfile=/var/run/phpfpm_exporter.pid
|
|
command="/usr/sbin/daemon"
|
|
procname="%%PREFIX%%/bin/phpfpm_exporter"
|
|
command_args="-p ${pidfile} /usr/bin/env ${procname} \
|
|
--addr ${phpfpm_exporter_listen_address} \
|
|
--endpoint ${phpfpm_exporter_endpoint}"
|
|
|
|
start_precmd=phpfpm_exporter_startprecmd
|
|
|
|
phpfpm_exporter_startprecmd()
|
|
{
|
|
if [ ! -e ${pidfile} ]; then
|
|
install -o ${phpfpm_exporter_user} -g ${phpfpm_exporter_group} /dev/null ${pidfile};
|
|
fi
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|