-
-
Save Jimmy-Xu/cccc7770907bba5097830b4bb75f4dd3 to your computer and use it in GitHub Desktop.
Connect to QEMU unix socket serial port
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/sh | |
SOCKDIR="/var/lib/qemu/sockets" | |
HOSTNAME="$1" | |
if [ -z "$HOSTNAME" ] | |
then | |
echo "usage: $0 HOSTNAME" >&2 | |
exit 1 | |
fi | |
SOCKET="${SOCKDIR}/serial.${HOSTNAME}.socket" | |
if [ ! -e "${SOCKET}" ] | |
then | |
echo "error: socket ${SOCKET} does not exist" >&2 | |
exit 1 | |
fi | |
echo "Starting Console... (ctrl+q to quit)" | |
exec socat stdin,raw,echo=0,escape=0x11 "unix-connect:${SOCKET}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment