mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2026-09-20 15:04:20 +00:00
feat: Preserve graceful shutdown for interactive console (#1290)
This commit is contained in:
+11
-2
@@ -104,6 +104,7 @@ cleanupHelpers() {
|
|||||||
|
|
||||||
startConsole() {
|
startConsole() {
|
||||||
|
|
||||||
|
local output="${1:-/dev/tty}"
|
||||||
local cnt=0
|
local cnt=0
|
||||||
local pid=""
|
local pid=""
|
||||||
|
|
||||||
@@ -116,7 +117,7 @@ startConsole() {
|
|||||||
|
|
||||||
(
|
(
|
||||||
trap '' INT QUIT
|
trap '' INT QUIT
|
||||||
exec nc -lU "$CONSOLE_SOCKET" </dev/tty >/dev/tty
|
exec nc -lU "$CONSOLE_SOCKET" </dev/tty >"$output"
|
||||||
) &
|
) &
|
||||||
|
|
||||||
pid=$!
|
pid=$!
|
||||||
@@ -143,6 +144,13 @@ startConsole() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stopConsole() {
|
||||||
|
|
||||||
|
mKill "$CONSOLE_PID"
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
finish() {
|
finish() {
|
||||||
|
|
||||||
local reason=$1
|
local reason=$1
|
||||||
@@ -283,7 +291,8 @@ graceful_shutdown() {
|
|||||||
|
|
||||||
if (( code == 130 && SHUTDOWN_SIGNAL == code )); then
|
if (( code == 130 && SHUTDOWN_SIGNAL == code )); then
|
||||||
SHUTDOWN_SKIP=1
|
SHUTDOWN_SKIP=1
|
||||||
echo && info "Received SIGINT again, forcing shutdown..." return
|
echo && info "Received SIGINT again, forcing shutdown..."
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo && info "Received $sig signal while already shutting down..."
|
echo && info "Received $sig signal while already shutting down..."
|
||||||
|
|||||||
Reference in New Issue
Block a user