1 |
olemarkus 13/07/30 10:10:09 |
2 |
|
3 |
Added: php-fpm-r1.init |
4 |
Log: |
5 |
Fix fpm restart issue |
6 |
|
7 |
(Portage version: 2.1.12.2/cvs/Linux x86_64, signed Manifest commit with key C4A92BF5) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 app-admin/eselect-php/files/php-fpm-r1.init |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/eselect-php/files/php-fpm-r1.init?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/eselect-php/files/php-fpm-r1.init?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: php-fpm-r1.init |
16 |
=================================================================== |
17 |
#!/sbin/runscript |
18 |
|
19 |
set_phpvars() { |
20 |
PHPSLOT=${SVCNAME#php-fpm-} |
21 |
PHP_FPM_PID="/run/php-fpm-${PHPSLOT}.pid" |
22 |
if [ ${PHPSLOT} = 'php-fpm' ] ; then |
23 |
PHPSLOT="$(eselect php show fpm)" |
24 |
PHP_FPM_PID="/run/php-fpm.pid" |
25 |
fi |
26 |
|
27 |
PHP_FPM_CONF="/etc/php/fpm-${PHPSLOT}/php-fpm.conf" |
28 |
} |
29 |
|
30 |
extra_commands="depend" |
31 |
extra_started_commands="reload" |
32 |
|
33 |
depend() { |
34 |
need net |
35 |
use apache2 lighttpd nginx |
36 |
} |
37 |
|
38 |
start() { |
39 |
ebegin "Starting PHP FastCGI Process Manager" |
40 |
set_phpvars |
41 |
start-stop-daemon --start --pidfile ${PHP_FPM_PID} --exec \ |
42 |
/usr/lib/${PHPSLOT}/bin/php-fpm -- -y "${PHP_FPM_CONF}" -g "${PHP_FPM_PID}" |
43 |
local i=0 |
44 |
local timeout=5 |
45 |
while [ ! -f ${PHP_FPM_PID} ] && [ $i -le $timeout ]; do |
46 |
sleep 1 |
47 |
i=$(($i + 1)) |
48 |
done |
49 |
|
50 |
[ $timeout -gt $i ] |
51 |
eend $? |
52 |
} |
53 |
|
54 |
stop() { |
55 |
ebegin "Stopping PHP FastCGI Process Manager" |
56 |
set_phpvars |
57 |
start-stop-daemon --signal QUIT --stop --exec /usr/lib/${PHPSLOT}/bin/php-fpm --pidfile ${PHP_FPM_PID} |
58 |
eend $? |
59 |
} |
60 |
|
61 |
reload() { |
62 |
ebegin "Reloading PHP FastCGI Process Manager" |
63 |
set_phpvars |
64 |
[ -f ${PHP_FPM_PID} ] && kill -USR2 $(cat ${PHP_FPM_PID}) |
65 |
eend $? |
66 |
} |