change the waiting for port loop logic and look for logs only after latest installation
This commit is contained in:
@@ -30,7 +30,8 @@ PLUGINS="${PLUGINS:-"none"}"
|
|||||||
REPOSITORY="${REPOSITORY:-"https://github.com/vatesfr/xen-orchestra"}"
|
REPOSITORY="${REPOSITORY:-"https://github.com/vatesfr/xen-orchestra"}"
|
||||||
|
|
||||||
# set variables not changeable in configfile
|
# set variables not changeable in configfile
|
||||||
TIME=$(date +%Y%d%m%H%M)
|
TIME=$(date +%Y%m%d%H%M)
|
||||||
|
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||||
LOGFILE="${LOGPATH}/xo-install.log-$TIME"
|
LOGFILE="${LOGPATH}/xo-install.log-$TIME"
|
||||||
NODEVERSION="12"
|
NODEVERSION="12"
|
||||||
|
|
||||||
@@ -681,14 +682,17 @@ function InstallXO {
|
|||||||
set +eo pipefail
|
set +eo pipefail
|
||||||
trap - ERR INT
|
trap - ERR INT
|
||||||
|
|
||||||
timeout 60 bash <<-"EOF"
|
count=0
|
||||||
while [[ -z $(journalctl -u xo-server | sed -n 'H; /Starting XO Server/h; ${g;p;}' | grep "https\{0,1\}:\/\/\[::\]:$PORT") ]]; do
|
limit=6
|
||||||
|
servicestatus="$(journalctl --since "$LOGTIME" -u xo-server | sed -n 'H; /Starting XO Server/h; ${g;p;}' | grep "https\{0,1\}:\/\/\[::\]:$PORT")"
|
||||||
|
while [[ -z "$servicestatus" ]] && [[ "$count" -lt "$limit" ]]; do
|
||||||
echo " waiting for port to be open"
|
echo " waiting for port to be open"
|
||||||
sleep 10
|
sleep 10
|
||||||
|
servicestatus="$(journalctl --since "$LOGTIME" -u xo-server | sed -n 'H; /Starting XO Server/h; ${g;p;}' | grep "https\{0,1\}:\/\/\[::\]:$PORT")"
|
||||||
|
(( count++ ))
|
||||||
done
|
done
|
||||||
EOF
|
|
||||||
|
|
||||||
if [[ $(journalctl -u xo-server | sed -n 'H; /Starting XO Server/h; ${g;p;}' | grep "https\{0,1\}:\/\/\[::\]:$PORT") ]]; then
|
if [[ ! -z "$servicestatus" ]]; then
|
||||||
echo
|
echo
|
||||||
echo -e " ${COLOR_GREEN}WebUI started in port $PORT. Make sure you have firewall rules in place to allow access.${COLOR_N}"
|
echo -e " ${COLOR_GREEN}WebUI started in port $PORT. Make sure you have firewall rules in place to allow access.${COLOR_N}"
|
||||||
if [[ "$TASK" == "Installation" ]]; then
|
if [[ "$TASK" == "Installation" ]]; then
|
||||||
@@ -708,7 +712,7 @@ function InstallXO {
|
|||||||
echo "$TASK failed" >> $LOGFILE
|
echo "$TASK failed" >> $LOGFILE
|
||||||
echo "xo-server service log:" >> $LOGFILE
|
echo "xo-server service log:" >> $LOGFILE
|
||||||
echo "" >> $LOGFILE
|
echo "" >> $LOGFILE
|
||||||
journalctl -u xo-server -n 100 >> $LOGFILE
|
journalctl --since "$LOGTIME" -u xo-server >> $LOGFILE
|
||||||
echo
|
echo
|
||||||
echo "Control xo-server service with systemctl for stop/start/restart etc."
|
echo "Control xo-server service with systemctl for stop/start/restart etc."
|
||||||
exit 1
|
exit 1
|
||||||
|
Reference in New Issue
Block a user