freebsd-ports/lang/php52/files/php-fpm.in
Doug Barton 83eb2c3700 In the rc.d scripts, change assignments to rcvar to use the
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.
2012-01-14 08:57:23 +00:00

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"