[X2Go-User] script to automatically restart x2go client session after coming out of suspend
Ulrich Sibiller
uli42 at gmx.de
Sat Feb 27 00:14:26 CET 2021
Nice! Thanks for sharing!
Uli
On Fri, Feb 26, 2021 at 11:59 PM Michael Ashley <m.ashley at unsw.edu.au> wrote:
>
> 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 at 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
> _______________________________________________
> x2go-user mailing list
> x2go-user at lists.x2go.org
> https://lists.x2go.org/listinfo/x2go-user
More information about the x2go-user
mailing list