Harden kill script and DNS config
This commit is contained in:
parent
68cf5f2cbb
commit
e10a51558e
3 changed files with 13 additions and 7 deletions
10
kill.sh
10
kill.sh
|
|
@ -77,10 +77,20 @@ fi
|
|||
|
||||
INFO_FILE="$(find_vm_info "$QUERY")"
|
||||
PID="$(get_prop "$INFO_FILE" "pid")"
|
||||
API_SOCK="$(get_prop "$INFO_FILE" "api_sock")"
|
||||
if [[ -z "$PID" ]]; then
|
||||
log "pid not found in $INFO_FILE"
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "$API_SOCK" ]]; then
|
||||
log "api_sock not found in $INFO_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! ps -p "$PID" -o comm=,args= 2>/dev/null | rg -q "firecracker.*--api-sock $API_SOCK"; then
|
||||
log "pid $PID does not match a running VM"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "sending SIG$SIGNAL to pid $PID"
|
||||
sudo kill "-$SIGNAL" "$PID"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue