[X2Go-Commits] x2goserver.git - build-baikal (branch) updated: 3.1.1.3-316-gc7a46b0

X2Go dev team git-admin at x2go.org
Fri Jan 3 20:51:59 CET 2014


The branch, build-baikal has been updated
       via  c7a46b0c53153100f2a9a19413f94aa0ca4a9fad (commit)
      from  2ab0beb6d5042203e466b2b3d028bd6f7ced1488 (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/bin/x2golistshadowsessions |   32 +++++++++++++++++++++-----------
 2 files changed, 22 insertions(+), 12 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index ff5cafc..545f032 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -34,6 +34,7 @@ x2goserver (4.1.0.0-0x2go1) UNRELEASED; urgency=low
     - Drop obsolete components x2goserver-compat, x2goserver-pyhoca.
     - Makefile: pre-set the PERL_INSTALLDIRS var with ,,vendor''. Use
       pure_install rather than install.
+    - Avoid one argument system calls in x2golistshadowsessions.
   * debian/control:
     + Package X2Go::Log in separate package: libx2go-log-perl.
     + Package X2Go::Server::DB in separate package: libx2go-server-db-perl.
@@ -64,7 +65,6 @@ x2goserver (4.1.0.0-0x2go1) UNRELEASED; urgency=low
     + Make sure x2goserver-*.features files do not get installed
       multiple times into various packages.
     + Make sure X2Go Server (x2gocleansessions) starts after installation.
-  * 
 
   [ Guangzhou Nianguan Electronics Technology Co.Ltd. ]
   * New upstream version (4.1.0.0):
diff --git a/x2goserver/bin/x2golistshadowsessions b/x2goserver/bin/x2golistshadowsessions
index 4a1a7f4..163dcbc 100755
--- a/x2goserver/bin/x2golistshadowsessions
+++ b/x2goserver/bin/x2golistshadowsessions
@@ -24,6 +24,8 @@ use strict;
 use Sys::Hostname;
 use Sys::Syslog qw( :standard :macros );
 
+use File::ReadBackwards;
+
 use X2Go::Server::DB qw(db_listshadowsessions db_listshadowsessions_all);
 use X2Go::Log qw(loglevel);
 
@@ -37,18 +39,26 @@ if ( @ARGV ) {
 	syslog('debug', "x2golistshadowsessions has been called with no option");
 }
 
-sub check_stat
+
+sub is_suspended
 {
-	my $sess=shift;
-	my $log="$ENV{'HOME'}/.x2go/C-$sess/session.log";
-	my $text=`tail -1 $log 2>/dev/null`;
-	if ($text =~ m/Session suspended/)
-	{
-		return 0;
-	}
-	return 1;
+        my $sess=shift;
+        my $log="$ENV{'HOME'}/.x2go/C-${sess}.log";
+        my $log_line;
+        my $log_file = File::ReadBackwards->new( $log ) or return 0;
+        while( defined( $log_line = $log_file->readline ) ) {
+                next if ( ! ( $log_line =~ m/^Session:/ ) );
+                last;
+        }
+        $log_file->close();
+        if ($log_line =~ m/Session suspended/)
+        {
+                return 1;
+        }
+        return 0;
 }
 
+
 my $serv=shift;
 if( ! $serv)
 {
@@ -78,11 +88,11 @@ for (my $i=0;$i<@outp;$i++)
 	{ 
 		if (@sinfo[4]eq 'R')
 		{
-			if(!check_stat(@sinfo[1]))
+			if(is_suspended(@sinfo[1]))
 			{
 				db_changestatus( 'S', @sinfo[1] );
 				@outp[$i] =~ s/\|R\|/\|S\|/;
-				system( "x2goumount-session @sinfo[1]");
+				system( "x2goumount-session","@sinfo[1]");
 			}
 		}
 		print "@outp[$i]\n";


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).




More information about the x2go-commits mailing list