Skip to content

Commit

Permalink
fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
BassT23 committed Jan 5, 2025
1 parent 432b1a1 commit 9a1a4d1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,8 @@ UPDATE_VM () {
echo -e "${BL}[Info]${OR} Sleep $SSH_START_DELAY_TIME secounds - time could be set in SSH-VM config file${CL}\n"
sleep "$SSH_START_DELAY_TIME"
fi
if ! (ssh -q -p "$SSH_VM_PORT" "$USER"@"$IP" exit >/dev/null 2>&1); then
# if ! (ssh -o BatchMode -q -p "$SSH_VM_PORT" "$USER"@"$IP" exit); then
if ! (ssh -o BatchMode=yes -o ConnectTimeout=5 -q -p "$SSH_VM_PORT" "$USER"@"$IP" exit >/dev/null 2>&1 || true); then
echo -e "${RD} File for ssh connection found, but not correctly set?\n\
${OR}Or need more start delay time.\n\
${BL}Please check SSH Key-Based Authentication${CL}\n\
Expand All @@ -742,8 +743,8 @@ UPDATE_VM () {
else
# Run SSH Update
SSH_CONNECTION="true"
KERNEL=$(qm guest cmd "$VM" get-osinfo | grep kernel-version || true)
OS=$(ssh -q -p "$SSH_VM_PORT" "$USER"@"$IP" hostnamectl | grep System || true)
KERNEL=$(qm guest cmd "$VM" get-osinfo >/dev/null 2>&1 | grep kernel-version || true)
OS=$(ssh -q -p "$SSH_VM_PORT" "$USER"@"$IP" hostnamectl >/dev/null 2>&1 | grep System || true)
# Check Internet connection
if ! ssh -q -p "$SSH_VM_PORT" "$USER"@"$IP" ping -q -c1 "$CHECK_URL" &>/dev/null || true; then
echo -e "${OR} Internet is not reachable - skip the update${CL}\n"
Expand Down Expand Up @@ -820,8 +821,8 @@ UPDATE_VM_QEMU () {
sleep "$VM_START_DELAY"
fi
# Run Update
KERNEL=$(qm guest cmd "$VM" get-osinfo | grep kernel-version || true)
OS=$(qm guest cmd "$VM" get-osinfo | grep name || true)
KERNEL=$(qm guest cmd "$VM" get-osinfo >/dev/null 2>&1 | grep kernel-version || true)
OS=$(qm guest cmd "$VM" get-osinfo >/dev/null 2>&1 | grep name || true)
# Check Internet connection
if ! qm guest exec "$VM" -- bash -c "ping -q -c1 $CHECK_URL &>/dev/null || true"; then
echo -e "${OR} Internet is not reachable - skip the update${CL}\n"
Expand Down

0 comments on commit 9a1a4d1

Please sign in to comment.