#!/bin/bash function cleanup() { kill -9 $PID1 $PID2 } flag=0 for i in $* do if [[ $flag -eq 1 ]] then domid=$i break fi if [[ "$i" == "-xen-domid" ]] then flag=1 fi done trap cleanup SIGINT SIGTERM /usr/lib/xen/bin/qemu-system-i386 -xen-domid $domid -xen-attach -display none -nographic -machine xenpv &> /tmp/pvqemu.log & PID1=$! /usr/lib/xen/bin/qemu-system-i386 $* -xenopts xsrestrict=on & PID2=$! while : do sleep 60 done