Bug 40901: (testing follow-up) Added enable / disable to more helpers
This patch adds more enable / disable flags to the koha daemon helper scripts. This is essential as systemd does not enable units by default, especially when using instantiation variables. Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
d28ded7538
commit
3073a347cc
|
|
@ -908,14 +908,17 @@ then
|
|||
fi
|
||||
service apache2 restart
|
||||
|
||||
# Start Zebra.
|
||||
# Enable & start Zebra.
|
||||
koha-zebra --enable "$name"
|
||||
koha-zebra --start "$name"
|
||||
|
||||
# Start workers
|
||||
koha-worker --all-queues --enable "$name"
|
||||
koha-worker --all-queues --start "$name"
|
||||
|
||||
if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
|
||||
# Start Indexer daemon
|
||||
koha-indexer --enable "$name"
|
||||
koha-indexer --start "$name"
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -65,14 +65,18 @@ do
|
|||
restart_apache="yes"
|
||||
if is_sip_enabled $name; then
|
||||
koha-sip --stop $name
|
||||
koha-sip --disable $name
|
||||
fi
|
||||
if is_zebra_running $name; then
|
||||
koha-zebra --stop $name
|
||||
koha-zebra --disable $name
|
||||
fi
|
||||
if is_indexer_running $name; then
|
||||
koha-indexer --stop $name
|
||||
koha-indexer --disable $name
|
||||
fi
|
||||
koha-worker --all-queues --stop $name || /bin/true
|
||||
koha-worker --all-queues --disable $name || /bin/true
|
||||
elif [ "$RET" = 2 ]; then
|
||||
warn "Error: Apache configuration file not present for instance $name."
|
||||
else
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ $scriptname -h|--help
|
|||
--start Start the ES indexing daemon for the specified instances
|
||||
--stop Stop the ES indexing daemon for the specified instances
|
||||
--restart Restart the ES indexing daemon for the specified instances
|
||||
--enable Enable the ES indexing daemon for the specified instances
|
||||
--disable Disable the ES indexing daemon for the specified instances
|
||||
--batch_size N Specify the batch size to commit at a time (default: 10)
|
||||
--status Show the status of the ES indexing for the specified instances
|
||||
--quiet|-q Make the script quiet about non existent instance names
|
||||
|
|
@ -86,6 +88,22 @@ restart_es_indexer()
|
|||
fi
|
||||
}
|
||||
|
||||
enable_es_indexer()
|
||||
{
|
||||
local name=$1
|
||||
if [ "$(koha_init_backend)" = "systemd" ]; then
|
||||
koha_service_ctl enable es-indexer "$name"
|
||||
fi
|
||||
}
|
||||
|
||||
disable_es_indexer()
|
||||
{
|
||||
local name=$1
|
||||
if [ "$(koha_init_backend)" = "systemd" ]; then
|
||||
koha_service_ctl disable es-indexer "$name"
|
||||
fi
|
||||
}
|
||||
|
||||
es_indexer_status()
|
||||
{
|
||||
local name=$1
|
||||
|
|
@ -130,6 +148,12 @@ while [ $# -gt 0 ]; do
|
|||
--restart)
|
||||
set_action "restart"
|
||||
shift ;;
|
||||
--enable)
|
||||
set_action "enable"
|
||||
shift ;;
|
||||
--disable)
|
||||
set_action "disable"
|
||||
shift ;;
|
||||
--status)
|
||||
set_action "status"
|
||||
shift ;;
|
||||
|
|
@ -164,6 +188,12 @@ if [ $# -gt 0 ]; then
|
|||
"restart")
|
||||
restart_es_indexer $name
|
||||
;;
|
||||
"enable")
|
||||
enable_es_indexer $name
|
||||
;;
|
||||
"disable")
|
||||
disable_es_indexer $name
|
||||
;;
|
||||
"status")
|
||||
es_indexer_status $name
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ koha_service_ctl()
|
|||
local unit=$(_koha_systemd_unit "$service" "$instance" "$queue")
|
||||
|
||||
case "$action" in
|
||||
start|stop|restart)
|
||||
start|stop|restart|enable|disable)
|
||||
systemctl "$action" "$unit" ;;
|
||||
reload)
|
||||
systemctl reload-or-restart "$unit" ;;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ $scriptname -h|--help
|
|||
--start Start the indexer daemon for the specified instances
|
||||
--stop Stop the indexer daemon for the specified instances
|
||||
--restart Restart the indexer daemon for the specified instances
|
||||
--enable Enable the indexer daemon for the specified instances
|
||||
--disable Disable the indexer daemon for the specified instances
|
||||
--status Show the status of the indexer for the specified instances
|
||||
--quiet|-q Make the script quiet about non existent instance names
|
||||
(useful for calling from another scripts).
|
||||
|
|
@ -85,6 +87,22 @@ restart_indexer()
|
|||
fi
|
||||
}
|
||||
|
||||
enable_indexer()
|
||||
{
|
||||
local name=$1
|
||||
if [ "$(koha_init_backend)" = "systemd" ]; then
|
||||
koha_service_ctl enable indexer "$name"
|
||||
fi
|
||||
}
|
||||
|
||||
disable_indexer()
|
||||
{
|
||||
local name=$1
|
||||
if [ "$(koha_init_backend)" = "systemd" ]; then
|
||||
koha_service_ctl disable indexer "$name"
|
||||
fi
|
||||
}
|
||||
|
||||
indexer_status()
|
||||
{
|
||||
local name=$1
|
||||
|
|
@ -125,6 +143,12 @@ while [ $# -gt 0 ]; do
|
|||
--restart)
|
||||
set_action "restart"
|
||||
shift ;;
|
||||
--enable)
|
||||
set_action "enable"
|
||||
shift ;;
|
||||
--disable)
|
||||
set_action "disable"
|
||||
shift ;;
|
||||
--status)
|
||||
set_action "status"
|
||||
shift ;;
|
||||
|
|
@ -178,6 +202,12 @@ if [ $# -gt 0 ]; then
|
|||
"restart")
|
||||
restart_indexer $name
|
||||
;;
|
||||
"enable")
|
||||
start_indexer $name
|
||||
;;
|
||||
"disable")
|
||||
stop_indexer $name
|
||||
;;
|
||||
"status")
|
||||
indexer_status $name
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -124,6 +124,10 @@ enable_plack()
|
|||
local instancename=$1
|
||||
local instancefile=$(get_apache_config_for "$instancename")
|
||||
|
||||
if [ "$(koha_init_backend)" = "systemd" ]; then
|
||||
koha_service_ctl enable plack "$instancename"
|
||||
fi
|
||||
|
||||
alreadyopac=0
|
||||
alreadyintra=0
|
||||
failopac=0
|
||||
|
|
@ -175,6 +179,10 @@ disable_plack()
|
|||
local instancename=$1
|
||||
local instancefile=$(get_apache_config_for "$instancename")
|
||||
|
||||
if [ "$(koha_init_backend)" = "systemd" ]; then
|
||||
koha_service_ctl disable plack "$instancename"
|
||||
fi
|
||||
|
||||
alreadyopac=0
|
||||
alreadyintra=0
|
||||
failopac=0
|
||||
|
|
|
|||
|
|
@ -76,24 +76,29 @@ eof
|
|||
# Stop the Zebra server if needed
|
||||
if is_zebra_running $name; then
|
||||
koha-zebra --stop $name || /bin/true
|
||||
koha-zebra --disable $name || /bin/true
|
||||
fi
|
||||
# Stop the indexer daemon if needed
|
||||
if is_indexer_running $name; then
|
||||
koha-indexer --stop $name || /bin/true
|
||||
koha-indexer --disable $name || /bin/true
|
||||
fi
|
||||
# Stop the worker daemons if needed
|
||||
koha-worker --all-queues --stop $name || /bin/true
|
||||
# Stop the Plack server if needed
|
||||
if is_plack_running $name; then
|
||||
koha-plack --stop $name || /bin/true
|
||||
koha-plack --disable $name || /bin/true
|
||||
fi
|
||||
# Stop the SIP server if needed
|
||||
if is_sip_running $name; then
|
||||
koha-sip --stop $name || /bin/true
|
||||
koha-sip --disable $name || /bin/true
|
||||
fi
|
||||
# Stop the ES indexing daemon if needed
|
||||
if is_es_indexer_running $name; then
|
||||
koha-es-indexer --stop $name || /bin/true
|
||||
koha-es-indexer --disable $name || /bin/true
|
||||
fi
|
||||
|
||||
instancefile=$(get_apache_config_for $name)
|
||||
|
|
|
|||
|
|
@ -102,6 +102,10 @@ enable_sip()
|
|||
local name=$1
|
||||
local libdir=/var/lib/koha/${name}
|
||||
|
||||
if [ "$(koha_init_backend)" = "systemd" ]; then
|
||||
koha_service_ctl enable sip "$name"
|
||||
fi
|
||||
|
||||
sipfile=/etc/koha/sites/${name}/SIPconfig.xml
|
||||
|
||||
if is_sip_enabled ${name}; then
|
||||
|
|
@ -123,6 +127,10 @@ disable_sip()
|
|||
local name=$1
|
||||
local libdir=/var/lib/koha/${name}
|
||||
|
||||
if [ "$(koha_init_backend)" = "systemd" ]; then
|
||||
koha_service_ctl enable sip "$name"
|
||||
fi
|
||||
|
||||
if is_sip_enabled ${name}; then
|
||||
# SIP is enabled, we should disable it
|
||||
echo "Stopping running SIP"
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ $scriptname -h|--help
|
|||
--start Start the worker daemon for the specified instances
|
||||
--stop Stop the worker daemon for the specified instances
|
||||
--restart Restart the worker daemon for the specified instances
|
||||
--enable Enable the worker daemon for the specified instances
|
||||
--disable Disable the worker daemon for the specified instances
|
||||
--queue Specify the queue/worker to perform the action on - 'default' is
|
||||
used if not specified (unless --all-queues is passed)
|
||||
current queues are: default, long_tasks
|
||||
|
|
@ -99,6 +101,28 @@ restart_worker()
|
|||
fi
|
||||
}
|
||||
|
||||
enable_worker()
|
||||
{
|
||||
local name=$1
|
||||
local queues=$2
|
||||
if [ "$(koha_init_backend)" = "systemd" ]; then
|
||||
for queue in $queues; do
|
||||
koha_service_ctl enable worker "$name" "$queue"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
disable_worker()
|
||||
{
|
||||
local name=$1
|
||||
local queues=$2
|
||||
if [ "$(koha_init_backend)" = "systemd" ]; then
|
||||
for queue in $queues; do
|
||||
koha_service_ctl disable worker "$name" "$queue"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
worker_status()
|
||||
{
|
||||
local name=$1
|
||||
|
|
@ -144,6 +168,12 @@ while [ $# -gt 0 ]; do
|
|||
--restart)
|
||||
set_action "restart"
|
||||
shift ;;
|
||||
--enable)
|
||||
set_action "enable"
|
||||
shift ;;
|
||||
--disable)
|
||||
set_action "disable"
|
||||
shift ;;
|
||||
--status)
|
||||
set_action "status"
|
||||
shift ;;
|
||||
|
|
@ -188,6 +218,12 @@ if [ $# -gt 0 ]; then
|
|||
"restart")
|
||||
restart_worker "$name" "$queues"
|
||||
;;
|
||||
"enable")
|
||||
enable_worker "$name" "$queues"
|
||||
;;
|
||||
"disable")
|
||||
disable_worker "$name" "$queues"
|
||||
;;
|
||||
"status")
|
||||
worker_status "$name" "$queues"
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ $scriptname -h|--help
|
|||
--stop Stop the Zebra daemon for the specified instance(s)
|
||||
--restart Restart the Zebra daemon for the specified instance(s)
|
||||
--status Show the status of the Zebra daemon for the specified instance(s)
|
||||
--enable Enable the Zebra daemon for the specified instance(s)
|
||||
--disable Disable the Zebra daemon for the specified instance(s)
|
||||
--verbose|-v Display progress and actions messages
|
||||
--help|-h Display this help message
|
||||
|
||||
|
|
@ -85,6 +87,22 @@ restart_zebra()
|
|||
fi
|
||||
}
|
||||
|
||||
enable_zebra()
|
||||
{
|
||||
local name=$1
|
||||
if [ "$(koha_init_backend)" = "systemd" ]; then
|
||||
koha_service_ctl enable zebra "$name"
|
||||
fi
|
||||
}
|
||||
|
||||
disable_zebra()
|
||||
{
|
||||
local name=$1
|
||||
if [ "$(koha_init_backend)" = "systemd" ]; then
|
||||
koha_service_ctl disable zebra "$name"
|
||||
fi
|
||||
}
|
||||
|
||||
zebra_status()
|
||||
{
|
||||
local name=$1
|
||||
|
|
@ -122,6 +140,10 @@ if [ "$used_script_name" != "koha-zebra" ]; then
|
|||
set_action "stop" ;;
|
||||
koha-restart-zebra)
|
||||
set_action "restart" ;;
|
||||
koha-enable-zebra)
|
||||
set_action "enable" ;;
|
||||
koha-disable-zebra)
|
||||
set_action "disable" ;;
|
||||
*)
|
||||
break ;;
|
||||
esac
|
||||
|
|
@ -146,6 +168,12 @@ while [ $# -gt 0 ]; do
|
|||
--restart)
|
||||
set_action "restart"
|
||||
shift ;;
|
||||
--enable)
|
||||
set_action "enable"
|
||||
shift ;;
|
||||
--disable)
|
||||
set_action "disable"
|
||||
shift ;;
|
||||
--status)
|
||||
set_action "status"
|
||||
shift ;;
|
||||
|
|
@ -176,6 +204,12 @@ if [ $# -gt 0 ]; then
|
|||
"restart")
|
||||
restart_zebra $name
|
||||
;;
|
||||
"enable")
|
||||
enable_zebra $name
|
||||
;;
|
||||
"disable")
|
||||
disable_zebra $name
|
||||
;;
|
||||
"status")
|
||||
zebra_status $name
|
||||
esac
|
||||
|
|
|
|||
Loading…
Reference in New Issue