30 lines
456 B
Bash
Executable file
30 lines
456 B
Bash
Executable file
#!/bin/bash
|
|
|
|
VM_LIST=`mktemp`
|
|
CT_LIST=`mktemp`
|
|
|
|
# We catch the VM & CT from each server
|
|
qm list | awk 'NR>1{ print $1 }' > $VM_LIST
|
|
pct list | awk 'NR>1{ print $1 }' > $CT_LIST
|
|
|
|
mapfile -t listvm < $VM_LIST
|
|
|
|
for i in ${listvm[@]};
|
|
do
|
|
echo "shutdown VM $i"
|
|
qm shutdown $i &
|
|
sleep 2s
|
|
done
|
|
|
|
|
|
mapfile -t listct < $CT_LIST
|
|
|
|
for i in ${listct[@]};
|
|
do
|
|
echo "shutdown CT $i"
|
|
pct shutdown $i &
|
|
sleep 2s
|
|
done
|
|
|
|
rm $VM_LIST
|
|
rm $CT_LIST
|