83eb2c3700
literal name_enable wherever possible, and ${name}_enable when it's not, to prepare for the demise of set_rcvar(). In cases where I had to hand-edit unusual instances also modify formatting slightly to be more uniform (and in some cases, correct). This includes adding some $FreeBSD$ tags, and most importantly moving rcvar= to right after name= so it's clear that one is derived from the other.
55 lines
956 B
Bash
55 lines
956 B
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: php-fpm
|
|
# REQUIRE: LOGIN
|
|
# BEFORE: securelevel
|
|
# KEYWORD: shutdown
|
|
|
|
# Add the following lines to /etc/rc.conf to enable php-fpm:
|
|
#
|
|
# php_fpm_enable="YES"
|
|
# php_fpm_config=""
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="php_fpm"
|
|
rcvar=php_fpm_enable
|
|
|
|
extra_commands="reload logrotate"
|
|
|
|
command="%%PREFIX%%/bin/php-cgi"
|
|
pidfile="%%PHP_FPM_PID%%"
|
|
reload_cmd="php_fpm_reload_cmd"
|
|
logrotate_cmd="php_fpm_logrotate_cmd"
|
|
|
|
# read configuration and set defaults
|
|
load_rc_config "$name"
|
|
: ${php_fpm_enable="NO"}
|
|
: ${php_fpm_config="%%PREFIX%%/etc/php-fpm.conf"}
|
|
|
|
required_files="${php_fpm_config}"
|
|
command_args="--fpm --fpm-config ${php_fpm_config}"
|
|
|
|
php_fpm_reload_cmd () {
|
|
if [ -z "$rc_pid" ]; then
|
|
_run_rc_notrunning
|
|
return 1
|
|
fi
|
|
echo "Reloading $name."
|
|
kill -USR2 $rc_pid
|
|
}
|
|
|
|
php_fpm_logrotate_cmd () {
|
|
if [ -z "$rc_pid" ]; then
|
|
_run_rc_notrunning
|
|
return 1
|
|
fi
|
|
echo "Rotating logs $name."
|
|
kill -USR1 $rc_pid
|
|
}
|
|
|
|
run_rc_command "$1"
|