mirror of
https://github.com/AuxXxilium/arv-v-dsm.git
synced 2024-11-23 23:10:58 +07:00
parent
7fd29e30b3
commit
143a2151fb
@ -9,7 +9,7 @@ file="/run/dsm.url"
|
||||
if [ ! -f "$file" ]; then
|
||||
|
||||
# Retrieve IP from guest VM for Docker healthcheck
|
||||
RESPONSE=$(curl -s -m 16 -S http://127.0.0.1:2210/read?command=10 2>&1)
|
||||
RESPONSE=$(curl -s -m 30 -S http://127.0.0.1:2210/read?command=10 2>&1)
|
||||
|
||||
if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then
|
||||
echo "Failed to connect to guest: $RESPONSE" && exit 1
|
||||
|
@ -5,7 +5,6 @@ set -Eeuo pipefail
|
||||
|
||||
QEMU_PORT=7100
|
||||
QEMU_TIMEOUT=50
|
||||
|
||||
QEMU_PID=/run/qemu.pid
|
||||
QEMU_COUNT=/run/qemu.count
|
||||
|
||||
@ -26,18 +25,18 @@ _graceful_shutdown() {
|
||||
[ ! -f "${QEMU_PID}" ] && exit 130
|
||||
[ -f "${QEMU_COUNT}" ] && return
|
||||
|
||||
echo && info "Received $1 signal, shutting down..."
|
||||
echo 0 > "${QEMU_COUNT}"
|
||||
echo && info "Received $1 signal, shutting down..."
|
||||
|
||||
# Don't send the powerdown signal because vDSM ignores ACPI signals
|
||||
# echo 'system_powerdown' | nc -q 1 -w 1 localhost "${QEMU_PORT}" > /dev/null
|
||||
|
||||
# Send shutdown command to guest agent via serial port
|
||||
RESPONSE=$(curl -s -m 5 -S http://127.0.0.1:2210/read?command=6 2>&1)
|
||||
RESPONSE=$(curl -s -m 30 -S http://127.0.0.1:2210/read?command=6 2>&1)
|
||||
|
||||
if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then
|
||||
if [[ ! "${RESPONSE}" =~ "\"success\"" ]]; then
|
||||
|
||||
echo && error "Could not send shutdown command to the guest ($RESPONSE)"
|
||||
echo && error "Failed to send shutdown command ( ${RESPONSE} )."
|
||||
|
||||
kill -15 "$(cat "${QEMU_PID}")"
|
||||
pkill -f qemu-system-x86_64 || true
|
||||
|
@ -15,7 +15,7 @@ do
|
||||
# Retrieve IP from guest VM
|
||||
|
||||
set +e
|
||||
RESPONSE=$(curl -s -m 16 -S http://127.0.0.1:2210/read?command=10 2>&1)
|
||||
RESPONSE=$(curl -s -m 30 -S http://127.0.0.1:2210/read?command=10 2>&1)
|
||||
set -e
|
||||
|
||||
if [[ ! "${RESPONSE}" =~ "\"success\"" ]] ; then
|
||||
|
@ -45,7 +45,7 @@ fi
|
||||
cnt=0
|
||||
sleep 0.2
|
||||
|
||||
while ! nc -z -w1 127.0.0.1 2210 > /dev/null 2>&1; do
|
||||
while ! nc -z -w2 127.0.0.1 2210 > /dev/null 2>&1; do
|
||||
sleep 0.1
|
||||
cnt=$((cnt + 1))
|
||||
(( cnt > 50 )) && error "Failed to connect to qemu-host.." && exit 58
|
||||
@ -53,7 +53,7 @@ done
|
||||
|
||||
cnt=0
|
||||
|
||||
while ! nc -z -w1 127.0.0.1 12345 > /dev/null 2>&1; do
|
||||
while ! nc -z -w2 127.0.0.1 12345 > /dev/null 2>&1; do
|
||||
sleep 0.1
|
||||
cnt=$((cnt + 1))
|
||||
(( cnt > 50 )) && error "Failed to connect to qemu-host.." && exit 59
|
||||
|
Loading…
Reference in New Issue
Block a user