Skip to content

Instantly share code, notes, and snippets.

@nlm
Created September 13, 2016 15:37
Show Gist options
  • Save nlm/63e68966f110fcdeefa3e5b73d228ab9 to your computer and use it in GitHub Desktop.
Save nlm/63e68966f110fcdeefa3e5b73d228ab9 to your computer and use it in GitHub Desktop.
Connect to QEMU unix socket serial port
#!/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