Bug 21366: Add koha-plack --reload to gracefully restart Plack/Starman
This patch adds a "--reload" option to koha-plack, which allows a sysadmin to gracefully restart Koha. This is very useful when installing Koha plugins or deploying a hot fix where you need to change code but don't want to interrupt anyone's usage of Koha. 0. Apply patch 1. cp /usr/sbin/koha-plack /usr/sbin/koha-plack.bak 2. cp debian/scripts/koha-plack /usr/sbin/koha-plack 3. ps -efww | grep "starman" 4. Now at roughly the same time do the following two actions: 4a. Go to http://localhost:8081/cgi-bin/koha/about.pl 4b. koha-plack --reload kohadev 5. Note that the web request completes successfully 6. ps -efww | grep "starman" 7. Note that the "starman master" process stays alive, but the "starman worker" processes have been restarted Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
89e890e7ce
commit
e0f1110389
1 changed files with 26 additions and 0 deletions
26
debian/scripts/koha-plack
vendored
26
debian/scripts/koha-plack
vendored
|
@ -169,6 +169,26 @@ restart_plack()
|
|||
fi
|
||||
}
|
||||
|
||||
reload_plack()
|
||||
{
|
||||
local instancename=$1
|
||||
|
||||
local PIDFILE="/var/run/koha/${instancename}/plack.pid"
|
||||
|
||||
if is_plack_running ${instancename}; then
|
||||
log_daemon_msg "Reloading Plack daemon for ${instancename}"
|
||||
|
||||
if start-stop-daemon --pidfile ${PIDFILE} --user="${instancename}-koha" --stop --signal HUP; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
else
|
||||
log_daemon_msg "Error: Plack not running for ${instancename}"
|
||||
log_end_msg 1
|
||||
fi
|
||||
}
|
||||
|
||||
enable_plack()
|
||||
{
|
||||
local instancename=$1
|
||||
|
@ -360,6 +380,9 @@ _do_instance() {
|
|||
"restart")
|
||||
restart_plack $name
|
||||
;;
|
||||
"reload")
|
||||
reload_plack $name
|
||||
;;
|
||||
"enable")
|
||||
enable_plack $name
|
||||
;;
|
||||
|
@ -398,6 +421,9 @@ while [ $# -gt 0 ]; do
|
|||
--restart)
|
||||
set_action "restart"
|
||||
shift ;;
|
||||
--reload)
|
||||
set_action "reload"
|
||||
shift ;;
|
||||
--enable)
|
||||
set_action "enable"
|
||||
shift ;;
|
||||
|
|
Loading…
Reference in a new issue