Skip to content

Instantly share code, notes, and snippets.

@devimc
Created May 22, 2018 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devimc/75f3e6b3172923e104b41b099fc8731a to your computer and use it in GitHub Desktop.
Save devimc/75f3e6b3172923e104b41b099fc8731a to your computer and use it in GitHub Desktop.

run command and exit

socat -d -d unix-client:/run/vc/sbs/18b2d72aa31b721b96d50e606684ab92fac19244cddd604dae35428fda5a28ce/console.sock pty,echo=0,raw &> /tmp/log &
sleep 1
pts=$(grep "N PTY is" /tmp/log | egrep -o "/dev/pts/[0-9]+")
echo "" > $pts
echo "uptime" > $pts
uptime=$(head -4 $pts)
killall socat
echo "VM uptime: " $uptime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment