On 2013-05-31 14:44, Ondřej Surý wrote:
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?

It does not have such support. It expects commands to handle HUP as a graceful reload. This is one reason apache has never been redone as an upstart job. I believe postfix also does not respond well to HUP.

This suggests more custom actions be added:

https://bugs.launchpad.net/upstart/+bug/94873

And this suggests just being able to change the signal:

https://bugs.launchpad.net/upstart/+bug/893021


--
To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/a76d807461c8a2fd1150c560256ac...@secure.spamaps.org

Reply via email to