The branch, build-main has been updated via 9d05c077283673a2386d07e678d54a0057e37f73 (commit) from 82ff682e9e52aaa158f35ec3b615580f57fd3419 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: debian/changelog | 2 ++ x2goserver/sbin/x2gocleansessions | 44 +++++++++++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) The diff of changes is: diff --git a/debian/changelog b/debian/changelog index 56eb297..3648e93 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ x2goserver (4.0.0.3-0~x2go1) UNRELEASED; urgency=low * New upstream version (4.0.0.3): - Make pre-set DESTDIR and PREFIX traverse through all Makefiles. Do not include DESTDIR in Makefile-hard-coded path in x2gosqlitewrapper. + - Add support to x2gocleansessions to suspend session via state changes + in the session DB. -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Sun, 19 May 2013 15:02:53 +0200 diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions index 6cc0edd..0be7cee 100755 --- a/x2goserver/sbin/x2gocleansessions +++ b/x2goserver/sbin/x2gocleansessions @@ -51,7 +51,20 @@ sub check_pid return 0; } -sub check_stat +sub has_terminated +{ + my $sess=shift; + my $user=shift; + my $log="/tmp/.x2go-${user}/session-C-${sess}.log"; + my $text=`tail -1 $log 2>/dev/null`; + if ($text =~ m/Session terminated/) + { + return 1; + } + return 0; +} + +sub is_suspended { my $sess=shift; my $user=shift; @@ -59,9 +72,22 @@ sub check_stat my $text=`tail -1 $log 2>/dev/null`; if ($text =~ m/Session suspended/) { - return 0; + return 1; + } + return 0; +} + +sub is_running +{ + my $sess=shift; + my $user=shift; + my $log="/tmp/.x2go-${user}/session-C-${sess}.log"; + my $text=`tail -1 $log 2>/dev/null`; + if (!is_suspended($sess, $user) && !has_terminated($sess, $user)) + { + return 1; } - return 1; + return 0; } sub catch_term @@ -116,7 +142,7 @@ elsif ($pid == 0 ) { if (@sinfo[4]eq 'R') { - if (!check_stat(@sinfo[1],@sinfo[11])) + if (is_suspended(@sinfo[1],@sinfo[11])) { system("su @sinfo[11] -c \"$x2go_lib_path/x2gochangestatus 'S' @sinfo[1] \" > /dev/null"); syslog('debug', "@sinfo[1] is suspended, changing status from @sinfo[4] to S"); @@ -124,6 +150,16 @@ elsif ($pid == 0 ) system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount-session @sinfo[1]\" 2> /dev/null"); } } + if (@sinfo[4]eq 'S') + { + if (is_running(@sinfo[1],@sinfo[11])) + { + syslog('debug', "@sinfo[1]: unmounting all shares"); + system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount-session @sinfo[1]\" 2> /dev/null"); + system("su @sinfo[11] -c \"x2gosuspend-session @sinfo[1] \" > /dev/null"); + syslog('debug', "@sinfo[1] was found running and has now been suspended"); + } + } } } } hooks/post-receive -- x2goserver.git (X2Go Server) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "x2goserver.git" (X2Go Server).