Add a action acript to handle FPM restarts

tags/0.0.1_0.fc26_el5
Daniel Berteaud 8 years ago
parent 98a234d6f6
commit b76293809c
  1. 6
      createlinks
  2. 37
      root/etc/e-smith/events/actions/adjust-php-fpm-services

@ -30,3 +30,9 @@ event_link("php-pool-dirs", "share-create", "90");
event_link("php-pool-dirs", "share-modify", "90");
event_link("php-pool-dirs", "share-modify-server", "90");
event_link("php-pool-dirs", "share-delete", "90");
event_link("adjust-php-fpm-services", "share-create", "98");
event_link("adjust-php-fpm-services", "share-modify", "98");
event_link("adjust-php-fpm-services", "share-modify-server", "98");
event_link("adjust-php-fpm-services", "share-delete", "98");
event_link("adjust-php-fpm-services", "webapps-update", "98");

@ -0,0 +1,37 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use esmith::ConfigDB;
my $c = esmith::ConfigDB->open_ro || die "Couldn't open the configuration database\n";
my @fpms = qw(
php-fpm
php56-php-fpm
php70-php-fpm
php71-php-fpm
);
# We need to ensure every versions are stopped, and only then start them all again
# so if we move a pool from one version to another, we won't have a socket conflict
foreach my $fpm (@fpms){
my $service = $c->get($fpm);
esmith::util::serviceControl(
NAME => $fpm,
ACTION => 'stop',
BACKGROUND => 'false')
or die "Unable to stop $fpm\n";
}
foreach my $fpm (@fpms){
my $service = $c->get($fpm);
if ($service && ($service->prop('status') || 'disabled') eq 'enabled'){
esmith::util::serviceControl(
NAME => $fpm,
ACTION => 'start',
BACKGROUND => 'false')
or die "Unable to start $fpm\n";
}
}
Loading…
Cancel
Save