Skip to content

Instantly share code, notes, and snippets.

@sentient06
Created December 3, 2024 10:12
Show Gist options
  • Save sentient06/cce2734c8761991abd8432bbd9772855 to your computer and use it in GitHub Desktop.
Save sentient06/cce2734c8761991abd8432bbd9772855 to your computer and use it in GitHub Desktop.
Classic Macintosh Projects - Script for checking if QEMU is running
#!/bin/bash
QEMU_SOCKET="/tmp/qemu-monitor.sock"
check_qemu_process() {
pgrep -f "qemu-system-ppc.*mac99" > /dev/null
}
check_monitor_socket() {
[ -S "$QEMU_SOCKET" ] && echo "info status" | nc -U -w 1 "$QEMU_SOCKET" > /dev/null 2>&1
}
if check_qemu_process; then
if check_monitor_socket; then
echo "QEMU PowerPC VM is running normally"
exit 0
else
echo "QEMU PowerPC VM process exists but monitor is not responding"
exit 2
fi
else
echo "QEMU PowerPC VM is not running"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment