Lines 14-20
Link Here
|
14 |
load_rc_config $name |
14 |
load_rc_config $name |
15 |
|
15 |
|
16 |
: ${spawn_fcgi_enable="NO"} |
16 |
: ${spawn_fcgi_enable="NO"} |
17 |
: ${spawn_fcgi_app=""} |
17 |
: ${spawn_fcgi_app="%%LOCALBASE%%/bin/php-cgi"} |
18 |
: ${spawn_fcgi_pidfile="/var/run/spawn-fcgi.pid"} |
18 |
: ${spawn_fcgi_pidfile="/var/run/spawn-fcgi.pid"} |
19 |
: ${spawn_fcgi_user="www"} |
19 |
: ${spawn_fcgi_user="www"} |
20 |
: ${spawn_fcgi_group="www"} |
20 |
: ${spawn_fcgi_group="www"} |
Lines 23-49
Link Here
|
23 |
: ${spawn_fcgi_children="5"} |
23 |
: ${spawn_fcgi_children="5"} |
24 |
: ${spawn_fcgi_max_requests="1000"} |
24 |
: ${spawn_fcgi_max_requests="1000"} |
25 |
: ${spawn_fcgi_allowed_env=""} |
25 |
: ${spawn_fcgi_allowed_env=""} |
26 |
|
26 |
: ${spawn_fcgi_path_env="/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin"} |
27 |
|
27 |
|
28 |
command="/usr/local/bin/spawn-fcgi" |
28 |
command="/usr/local/bin/spawn-fcgi" |
29 |
command_args="-u ${spawn_fcgi_user} -g ${spawn_fcgi_group} -a ${spawn_fcgi_bindaddr} -p ${spawn_fcgi_bindport} -P ${spawn_fcgi_pidfile} -- ${spawn_fcgi_app}" |
29 |
command_args="-u ${spawn_fcgi_user} -g ${spawn_fcgi_group} -a ${spawn_fcgi_bindaddr} -p ${spawn_fcgi_bindport} -P ${spawn_fcgi_pidfile} -- ${spawn_fcgi_app}" |
30 |
pidfile=${spawn_fcgi_pidfile} |
30 |
pidfile=${spawn_fcgi_pidfile} |
|
|
31 |
procname=${spawn_fcgi_app} |
31 |
|
32 |
|
32 |
_allowed_env="PATH USER PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS" |
33 |
_allowed_env="PATH USER PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS" |
33 |
_allowed_env="${_allowed_env} ${spawn_fcgi_allowed_env}" |
34 |
_allowed_env="${_allowed_env} ${spawn_fcgi_allowed_env}" |
34 |
|
35 |
|
35 |
start_precmd="${name}_start_precmd" |
36 |
start_precmd="${name}_start_precmd" |
36 |
stop_cmd="${name}_stop_cmd" |
|
|
37 |
stop_postcmd="${name}_stop_postcmd" |
37 |
stop_postcmd="${name}_stop_postcmd" |
38 |
|
38 |
|
39 |
spawn_fcgi_start_precmd() |
39 |
spawn_fcgi_start_precmd() |
40 |
{ |
40 |
{ |
41 |
touch ${pidfile} |
41 |
touch ${pidfile} |
42 |
chown ${spawn_fcgi_user}:${spawn_fcgi_group} ${pidfile} |
42 |
chown ${spawn_fcgi_user}:${spawn_fcgi_group} ${pidfile} |
43 |
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin |
43 |
export PATH=${spawn_fcgi_path_env} |
|
|
44 |
export USER=${spawn_fcgi_user} |
44 |
export PHP_FCGI_CHILDREN=${spawn_fcgi_children} |
45 |
export PHP_FCGI_CHILDREN=${spawn_fcgi_children} |
45 |
export PHP_FCGI_MAX_REQUESTS=${spawn_fastcgi_max_requests} |
46 |
export PHP_FCGI_MAX_REQUESTS=${spawn_fastcgi_max_requests} |
46 |
export USER=${spawn_fcgi_user} |
|
|
47 |
E= |
47 |
E= |
48 |
for i in ${_allowed_env}; do |
48 |
for i in ${_allowed_env}; do |
49 |
eval _val="\$$i" |
49 |
eval _val="\$$i" |
Lines 55-66
Link Here
|
55 |
command="env - ${E} ${command}" |
55 |
command="env - ${E} ${command}" |
56 |
} |
56 |
} |
57 |
|
57 |
|
58 |
spawn_fcgi_stop_cmd() |
|
|
59 |
{ |
60 |
read rc_pid < ${pidfile} |
61 |
kill ${sig_stop} ${rc_pid} |
62 |
} |
63 |
|
64 |
spawn_fcgi_stop_postcmd() |
58 |
spawn_fcgi_stop_postcmd() |
65 |
{ |
59 |
{ |
66 |
rm -f ${pidfile} |
60 |
rm -f ${pidfile} |