Hello everyone,
I was wondering if there is a way to timeout sessions after a certain period of inactivity?
I have several users launching application through X2Go and they may leave the windows idle for several days. Ideally I would like to be able to kill those sessions after a certain period of inactivity. Is this possible?
Thanks! Ivan
Ivan Gomez Consultant Zencos Consulting<http://www.zencos.com/> igomez@zencos.com<mailto:igomez@zencos.com> mobile: (919) 576-0614
The information in this e-mail and any attached files is confidential. It is intended solely for the use of the addressee. Any unauthorized disclosure or use is prohibited. If you are not the intended recipient of the message, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. The views of the author may not necessarily reflect those of the company.
Am 18.08.2017 um 21:08 schrieb Ivan Gomez:
I was wondering if there is a way to timeout sessions after a certain period of inactivity?
I have several users launching application through X2Go and they may leave the windows idle for several days. Ideally I would like to be able to kill those sessions after a certain period of inactivity. Is this possible?
Well, some people might do this intentionally, like people use screen or tmux to keep a task running even when they're not present or not even connected to the system. Terminating their sessions when they don't expect it might not be the best idea.
You could set up a cron job that parses the output of x2golistsessions_root and calls x2goterminate-session for each sessionid (field 2) that is older than n days (using field 6:init time, or field 11:last time dataset has been updated, or field 13, session age in seconds), but that will terminate sessions that have been open that long, no matter if they're idle or actively used.
Of course, if you filter for suspended sessions only (field 5, state S), then you could use it to terminate suspended sessions older than n days
-Stefan
-- BAUR-ITCS UG (haftungsbeschränkt) Geschäftsführer: Stefan Baur Eichenäckerweg 10, 89081 Ulm | Registergericht Ulm, HRB 724364 Fon/Fax 0731 40 34 66-36/-35 | USt-IdNr.: DE268653243
Thank you for your feedback Stefan.
I understand your concern about terminating sessions when people are running tasks through screen or tmux. I would add a check to avoid killing these type of sessions.
Thank you and have a good day. Ivan
-----Original Message----- From: x2go-user [mailto:x2go-user-bounces@lists.x2go.org] On Behalf Of Stefan Baur Sent: Friday, August 18, 2017 4:05 PM To: x2go-user@lists.x2go.org Subject: Re: [X2Go-User] Timeout user sessions
Am 18.08.2017 um 21:08 schrieb Ivan Gomez:
I was wondering if there is a way to timeout sessions after a certain period of inactivity?
I have several users launching application through X2Go and they may leave the windows idle for several days. Ideally I would like to be able to kill those sessions after a certain period of inactivity. Is this possible?
Well, some people might do this intentionally, like people use screen or tmux to keep a task running even when they're not present or not even connected to the system. Terminating their sessions when they don't expect it might not be the best idea.
You could set up a cron job that parses the output of x2golistsessions_root and calls x2goterminate-session for each sessionid (field 2) that is older than n days (using field 6:init time, or field 11:last time dataset has been updated, or field 13, session age in seconds), but that will terminate sessions that have been open that long, no matter if they're idle or actively used.
Of course, if you filter for suspended sessions only (field 5, state S), then you could use it to terminate suspended sessions older than n days
-Stefan
-- BAUR-ITCS UG (haftungsbeschränkt) Geschäftsführer: Stefan Baur Eichenäckerweg 10, 89081 Ulm | Registergericht Ulm, HRB 724364 Fon/Fax 0731 40 34 66-36/-35 | USt-IdNr.: DE268653243
Am 21.08.2017 um 16:05 schrieb Ivan Gomez:
Thank you for your feedback Stefan.
I understand your concern about terminating sessions when people are running tasks through screen or tmux. I would add a check to avoid killing these type of sessions.
No, you misunderstood what I said. Some people use X2Go sessions for having GUI apps run "detached" just like people use screen or tmux for running console apps "detached".
There is no easy way to determine whether a session is suspended because a user just forgot about it, or whether they intentionally disconnected from it, expecting the apps to continue to run.
-Stefan
-- BAUR-ITCS UG (haftungsbeschränkt) Geschäftsführer: Stefan Baur Eichenäckerweg 10, 89081 Ulm | Registergericht Ulm, HRB 724364 Fon/Fax 0731 40 34 66-36/-35 | USt-IdNr.: DE268653243
Until and unless someone invents psychic software...
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting. Knowledgeable human assistance, not telephone trees or script readers. See our web site: http://www.eskimo.com/ (206) 812-0051 or (800) 246-6874.
On Mon, 21 Aug 2017, Stefan Baur wrote:
Date: Mon, 21 Aug 2017 16:20:34 +0200 From: Stefan Baur <X2Go-ML-1@baur-itcs.de> To: Ivan Gomez <igomez@zencos.com>, "x2go-user@lists.x2go.org" <x2go-user@lists.x2go.org> Subject: Re: [X2Go-User] Timeout user sessions
Am 21.08.2017 um 16:05 schrieb Ivan Gomez:
Thank you for your feedback Stefan.
I understand your concern about terminating sessions when people are running tasks through screen or tmux. I would add a check to avoid killing these type of sessions.
No, you misunderstood what I said. Some people use X2Go sessions for having GUI apps run "detached" just like people use screen or tmux for running console apps "detached".
There is no easy way to determine whether a session is suspended because a user just forgot about it, or whether they intentionally disconnected from it, expecting the apps to continue to run.
-Stefan
-- BAUR-ITCS UG (haftungsbeschränkt) Geschäftsführer: Stefan Baur Eichenäckerweg 10, 89081 Ulm | Registergericht Ulm, HRB 724364 Fon/Fax 0731 40 34 66-36/-35 | USt-IdNr.: DE268653243
Thank you for the feedback.
I'm using X2Go in combination with a load balancer, which gives me information about the session processes (CPU used, memory, pids, etc). I can easily combine the information from x2golistsessions_root and the load balancer to determine if sessions are executing work in the background and thus avoid killing them.
Thank you and have a good day.
-----Original Message----- From: Robert Dinse [mailto:nanook@eskimo.com] Sent: Monday, August 21, 2017 10:52 AM To: Stefan Baur <X2Go-ML-1@baur-itcs.de> Cc: Ivan Gomez <igomez@zencos.com>; x2go-user@lists.x2go.org Subject: Re: [X2Go-User] Timeout user sessions
Until and unless someone invents psychic software...
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting. Knowledgeable human assistance, not telephone trees or script readers. See our web site: http://www.eskimo.com/ (206) 812-0051 or (800) 246-6874.
On Mon, 21 Aug 2017, Stefan Baur wrote:
Date: Mon, 21 Aug 2017 16:20:34 +0200 From: Stefan Baur <X2Go-ML-1@baur-itcs.de> To: Ivan Gomez <igomez@zencos.com>, "x2go-user@lists.x2go.org" <x2go-user@lists.x2go.org> Subject: Re: [X2Go-User] Timeout user sessions
Am 21.08.2017 um 16:05 schrieb Ivan Gomez:
Thank you for your feedback Stefan.
I understand your concern about terminating sessions when people are running tasks through screen or tmux. I would add a check to avoid killing these type of sessions.
No, you misunderstood what I said. Some people use X2Go sessions for having GUI apps run "detached" just like people use screen or tmux for running console apps "detached".
There is no easy way to determine whether a session is suspended because a user just forgot about it, or whether they intentionally disconnected from it, expecting the apps to continue to run.
-Stefan
-- BAUR-ITCS UG (haftungsbeschränkt) Geschäftsführer: Stefan Baur Eichenäckerweg 10, 89081 Ulm | Registergericht Ulm, HRB 724364 Fon/Fax 0731 40 34 66-36/-35 | USt-IdNr.: DE268653243
I also considered this. CPU/memory etc. utilization for GUI programs is not a very unreliable indicator. Most elegant solution would be to send the user an email like "please login or your session will be closed at 18:00 tomorrow" (possibly in combination with some ~/dontkillme file). It may also teach users to pre-emptively close unused sessions to avoid unwanted emails. I did not implement it for sessions (no pressing need), but something similar works quite well for kernel updates here.
--
With Best Regards, Marat Khalili
Am 21.08.2017 um 16:52 schrieb Robert Dinse:
Until and unless someone invents psychic software...
Well, you could train users to run "touch ~/dontkillme" and check how old that file is, before terminating the session ... and tell them they need to touch it again after a day, or a week, or whatever.
Of course, then some smartbutt will set up a cronjob/loop to do just that. ;-)
-Stefan
-- BAUR-ITCS UG (haftungsbeschränkt) Geschäftsführer: Stefan Baur Eichenäckerweg 10, 89081 Ulm | Registergericht Ulm, HRB 724364 Fon/Fax 0731 40 34 66-36/-35 | USt-IdNr.: DE268653243