feat: shutdown existing xo-server/xo-proxy processes after new build has finished

This commit is contained in:
Roni Väyrynen
2022-10-15 20:21:10 +03:00
parent 9c1acdc2bb
commit 9d94bd6e22

View File

@@ -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"