From 9d94bd6e2257f0044a2090397f1a823ce6ce759e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roni=20V=C3=A4yrynen?= Date: Sat, 15 Oct 2022 20:21:10 +0300 Subject: [PATCH] feat: shutdown existing xo-server/xo-proxy processes after new build has finished --- xo-install.sh | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/xo-install.sh b/xo-install.sh index 93305b1..e388e56 100755 --- a/xo-install.sh +++ b/xo-install.sh @@ -686,18 +686,6 @@ function InstallXO { PrepInstall - # Now that we know we're going to be building a new xen-orchestra, make - # sure there's no already-running xo-server process. - if [[ $(runcmd_stdout "pgrep -f xo-server") ]]; then - echo - printprog "Shutting down xo-server" - runcmd "/bin/systemctl stop xo-server" || { - printfail "failed to stop service, exiting..." - exit 1 - } - printok "Shutting down xo-server" - fi - # Fetch 3rd party plugins source code InstallAdditionalXOPlugins @@ -711,6 +699,18 @@ function InstallXO { # Install plugins (takes care of 3rd party plugins as well) InstallXOPlugins + # shutdown possibly running xo-server + if [[ $(runcmd_stdout "pgrep -f xo-server") ]]; then + echo + printprog "Shutting down running xo-server" + runcmd "/bin/systemctl stop xo-server" || { + printfail "failed to stop service, exiting..." + exit 1 + } + printok "Shutting down running xo-server" + sleep 3 + fi + echo printinfo "Fixing binary path in systemd service configuration file" # shellcheck disable=SC1117 @@ -953,17 +953,6 @@ function InstallXOProxy { PrepInstall - # check that xo-proxy is not running - if [[ $(runcmd_stdout "pgrep -f xo-proxy") ]]; then - echo - printprog "Shutting down xo-proxy" - runcmd "/bin/systemctl stop xo-proxy" || { - printfail "failed to stop service, exiting..." - exit 1 - } - printok "Shutting down xo-proxy" - fi - echo printinfo "xo-proxy build takes quite a while. Grab a cup of coffee and lay back" echo @@ -971,6 +960,18 @@ function InstallXOProxy { runcmd "cd $INSTALLDIR/xo-builds/xen-orchestra-$TIME && yarn && yarn build" printok "Running installation" + # shutdown possibly running xo-server + if [[ $(runcmd_stdout "pgrep -f xo-proxy") ]]; then + echo + printprog "Shutting down running xo-proxy" + runcmd "/bin/systemctl stop xo-proxy" || { + printfail "failed to stop service, exiting..." + exit 1 + } + printok "Shutting down running xo-proxy" + sleep 3 + fi + echo printinfo "Disabling license check in proxy to enable running it in XO from sources"