2021-12-05 22:47:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
printf '['
|
|
|
|
delimiter=""
|
2021-12-08 18:57:22 +00:00
|
|
|
virsh list --all | tail -n +3 | while read -r line; do
|
2021-12-09 18:40:30 +00:00
|
|
|
if [ "$line" != "" ]; then
|
|
|
|
capsul_id="$(echo "$line" | awk '{ print $2 }')"
|
|
|
|
capsul_state="$(echo "$line" | sed -E 's/^ *[0-9-]+ +[^ ]+ +//')"
|
|
|
|
printf '%s\n {"id":"%s", "state":"%s"}' "$delimiter" "$capsul_id" "$capsul_state"
|
|
|
|
delimiter=","
|
|
|
|
fi
|
2021-12-05 22:47:37 +00:00
|
|
|
done
|
|
|
|
printf '\n]\n'
|