Hi folks,
I thought that some of you might be interested in a small script that I use to automatically restart an x2go client session after returning from suspending the client computer:
#!/bin/bash
while true; do
pyhoca-cli -R NEWEST --link wan -g 3768x2123 --pack 16m-png-jpeg-9 user@computer &
while ! wmctrl -r X2GO -e 0,0,0,3768,2123; do sleep 1; done
echo sleeping
sleep 10
wait
done
The idea is to use pyhoca-cli to handle the connection. The "wait" line waits until the pyhoca-cli subprocess ends, which happens shortly after the computer comes out of suspend. The "wmctrl" line is just to resize the window to fit my display. Change the numbers 3768x2123 to suit. The "sleep 10" I had in there while debugging to avoid runaway creation of sub-processes, which is capable of crashing the x2go server session.
The nice thing about this script is that I can be up and running with the x2go client session within less than 10 seconds or so of coming out of suspend, without having to tediously interact with the x2goclient GUI. In turn, this means that there is almost no friction in suspending/resuming my desktop computer, with consequent power savings.
The script could be improved by starting a new session if there is no existing one.
Regards,
Michael