有人可以帮助我制作一个简单的脚本来启动虚拟机并在后台延迟 10 秒后重置虚拟机,同时虚拟机在 Arch linkux (manjaro) 的 Virt 管理器中运行
答案1
#!/bin/sh
# The first and only arg is the name of the VM
[ -z "$1" ] && echo "Error: VM name was not provided" >/dev/stderr && exit 1
vm="$1"
virsh start "$vm"
sleep 10
virsh reboot "$vm"