diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index 38f3707830..5c64cbaea0 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -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 diff --git a/debian/scripts/koha-disable b/debian/scripts/koha-disable index 4546a81a3d..7be1d0acc7 100755 --- a/debian/scripts/koha-disable +++ b/debian/scripts/koha-disable @@ -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 diff --git a/debian/scripts/koha-es-indexer b/debian/scripts/koha-es-indexer index 4407ec4fa7..72efaca1c1 100755 --- a/debian/scripts/koha-es-indexer +++ b/debian/scripts/koha-es-indexer @@ -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 diff --git a/debian/scripts/koha-functions.sh b/debian/scripts/koha-functions.sh index 73e2ca626e..9d0d06db64 100755 --- a/debian/scripts/koha-functions.sh +++ b/debian/scripts/koha-functions.sh @@ -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" ;; diff --git a/debian/scripts/koha-indexer b/debian/scripts/koha-indexer index 40aaf964a4..5997b0f3f9 100755 --- a/debian/scripts/koha-indexer +++ b/debian/scripts/koha-indexer @@ -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 diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack index 3b3dac0399..f9092d7b04 100755 --- a/debian/scripts/koha-plack +++ b/debian/scripts/koha-plack @@ -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 diff --git a/debian/scripts/koha-remove b/debian/scripts/koha-remove index 10866aa9ad..1f2a670473 100755 --- a/debian/scripts/koha-remove +++ b/debian/scripts/koha-remove @@ -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) diff --git a/debian/scripts/koha-sip b/debian/scripts/koha-sip index d2fdbf4e8a..a4ca238c4f 100755 --- a/debian/scripts/koha-sip +++ b/debian/scripts/koha-sip @@ -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" diff --git a/debian/scripts/koha-worker b/debian/scripts/koha-worker index a2ee757a2b..ffe72c102e 100755 --- a/debian/scripts/koha-worker +++ b/debian/scripts/koha-worker @@ -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 diff --git a/debian/scripts/koha-zebra b/debian/scripts/koha-zebra index 7eee7aced6..623708a0e0 100755 --- a/debian/scripts/koha-zebra +++ b/debian/scripts/koha-zebra @@ -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