diff options
author | Brian Evans <grknight@gentoo.org> | 2021-10-22 14:12:15 -0400 |
---|---|---|
committer | Brian Evans <grknight@gentoo.org> | 2021-10-22 14:12:15 -0400 |
commit | 579d324cc25bfe454b1486e8bbc89e9a41c41f79 (patch) | |
tree | 07f2f73dd0e23995d97f04f362c4c82e7f14bf1d /openrc | |
parent | configure.ac: rename AC_HELP_STRING -> AS_HELP_STRING. (diff) | |
download | eselect-php-579d324cc25bfe454b1486e8bbc89e9a41c41f79.tar.gz eselect-php-579d324cc25bfe454b1486e8bbc89e9a41c41f79.tar.bz2 eselect-php-579d324cc25bfe454b1486e8bbc89e9a41c41f79.zip |
Save PHP_SLOT for reuse on stop
Update the php-fpm script to allow the starting slot to be saved.
This can then be used by the stop process to track the correct pidfile of
what was started.
Avoids errors when upgrading the unslotted script from one slot to another.
eselect value will change and OpenRC is confused on what to stop as we give
it the wrong PID location
Signed-off-by: Brian Evans <grknight@gentoo.org>
Diffstat (limited to 'openrc')
-rw-r--r-- | openrc/init.d/php-fpm.in.in | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/openrc/init.d/php-fpm.in.in b/openrc/init.d/php-fpm.in.in index 2eaa2c3..3e67e3c 100644 --- a/openrc/init.d/php-fpm.in.in +++ b/openrc/init.d/php-fpm.in.in @@ -15,9 +15,15 @@ # slot php7.1 eselected, but also a php-fpm-php7.1 init script. Should # they manage the same instance? I think so... # + PHP_SLOT="${SVCNAME#php-fpm-}" if [ "${PHP_SLOT}" = "php-fpm" ] ; then - PHP_SLOT="$(eselect php show fpm)" + # Getting the saved slot allows for clean stops when upgrading to a new slot + # This will initially be empty on start and fall through to the default + PHP_SLOT="$(service_get_value PHP_SLOT)" + if [ -z "${PHP_SLOT}" ]; then + PHP_SLOT="$(eselect php show fpm)" + fi fi PHP_FPM_CONF="@SYSCONFDIR@/php/fpm-${PHP_SLOT}/php-fpm.conf" @@ -59,6 +65,7 @@ start_pre() { if [ "${RC_CMD}" != "restart" ] ; then configtest || return $? fi + service_set_value PHP_SLOT "${PHP_SLOT}" } stop_pre() { |