Hi,

I have tried to rewrite php5-fpm init.d file for systemd and upstart and
ended up with:

cat > php5-fpm.service << EOF
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=forking
PIDFile=/var/run/php5-fpm.pid
ExecStartPre=sh -c 'if [ -n "$(/usr/sbin/php5-fpm --fpm-config
/etc/php5/fpm/php-fpm.conf -t 2>&1 | grep "\[ERROR\]")" ]; then echo
"Please fix your configuration file..."; /usr/sbin/php5-fpm --f\
pm-config /etc/php5/fpm/php-fpm.conf -t 2>&1 | grep "\[ERROR\]"; exit 1; fi'
ExecStart=/usr/sbin/php5-fpm
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target
EOF

and

cat > php5-fpm.upstart << EOF
# php5-fpm - The PHP FastCGI Process Manager



description "The PHP FastCGI Process Manager"
author "Ondřej Surý <ond...@debian.org>"

start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]

pre-start script
  if [ -n "$(/usr/sbin/php5-fpm --fpm-config /etc/php5/fpm/php-fpm.conf -t
2>&1 | grep "\[ERROR\]")" ]; then
    echo "Please fix your configuration file..."
    /usr/sbin/php5-fpm --fpm-config /etc/php5/fpm/php-fpm.conf -t 2>&1 |
grep "\[ERROR\]"
    stop ; exit 1
  fi
end script

respawn
exec /usr/sbin/php5-fpm --fpm-config /etc/php5/fpm/php-fpm.conf
EOF

It's pretty much equivalent with one exception – I need to send USR2 on
reload. Does upstart already have the support for custom reload signals?

Ondrej
-- 
Ondřej Surý <ond...@sury.org>

Reply via email to