Created
September 13, 2016 15:37
-
-
Save nlm/63e68966f110fcdeefa3e5b73d228ab9 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