Created
December 3, 2024 10:12
-
-
Save sentient06/cce2734c8761991abd8432bbd9772855 to your computer and use it in GitHub Desktop.
Classic Macintosh Projects - Script for checking if QEMU is running
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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