#!/bin/sh /etc/rc.common START=99 STOP=1 qemu_pidfile="/var/run/qemu.pid" start() { qemu-system-x86_64 -enable-kvm -cpu host -smp 2 -m 2G \ -drive file=/dev/sda,cache=none,if=virtio,format=raw \ -device virtio-net-pci,mac=E2:F2:6A:01:9D:C9,netdev=br0 \ -netdev bridge,br=br-lan,id=br0 \ -qmp tcp:127.0.0.1:4444,server,nowait \ -daemonize &> /var/log/qemu.log /usr/bin/pgrep qemu-system-x86_64 > $qemu_pidfile echo "QEMU: Started VM with PID $(cat $qemu_pidfile)." } stop() { echo "QEMU: Sending 'system_powerdown' to VM with PID $(cat $qemu_pidfile)." nc localhost 4444 <