This commit is contained in:
12
src/share/stopvm.sh
Normal file
12
src/share/stopvm.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env -S bash
|
||||
|
||||
CONFIG_FILE='/etc/vm/config.jsonnet'
|
||||
|
||||
vm="$1"
|
||||
shift
|
||||
|
||||
mapfile -t endPoint <<< "$(jsonnet "$CONFIG_FILE" | jq -r ".${vm}[]" | sed -nr 's/^-monitor telnet:(\w+):(\w+).*$/\1\n\2/p')"
|
||||
|
||||
nc "${endPoint[0]}" "${endPoint[1]}" <<'EOF'
|
||||
system_powerdown
|
||||
EOF
|
||||
Reference in New Issue
Block a user