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

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


The branch, build-baikal has been updated
       via  2ab0beb6d5042203e466b2b3d028bd6f7ced1488 (commit)
      from  d3cae4427292c8aa25916bca439694fb80dda61c (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/x2golistsessions |   26 ++++++++++++++++++--------
 2 files changed, 20 insertions(+), 8 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index e362382..ff5cafc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -64,6 +64,7 @@ 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):
@@ -256,6 +257,7 @@ x2goserver (4.0.0.8-0x2go1) UNRELEASED; urgency=low
       for finding this!!! (Fixes: #356).
     - Avoid one argument system calls and backticks in x2gocleansessions and
       x2golistsessions_root.
+    - Avoid one argument system calls and backticks in x2golistsessions.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Thu, 28 Nov 2013 16:14:32 +0100
 
diff --git a/x2goserver/bin/x2golistsessions b/x2goserver/bin/x2golistsessions
index 46ac0c6..2a9e548 100755
--- a/x2goserver/bin/x2golistsessions
+++ b/x2goserver/bin/x2golistsessions
@@ -24,6 +24,8 @@ use strict;
 use Sys::Hostname;
 use Sys::Syslog qw( :standard :macros );
 
+use File::ReadBackwards;
+
 use X2Go::Server::DB qw(db_listsessions db_listsessions_all db_changestatus);
 use X2Go::Log qw(loglevel);
 
@@ -37,18 +39,26 @@ if ( @ARGV ) {
 	syslog('debug', "x2golistsessions 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/)
+	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 0;
+		return 1;
 	}
-	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