[X2Go-Commits] x2gobroker.git - build-main (branch) updated: 0.0.0.1-44-g6267590

X2Go dev team git-admin at x2go.org
Sun May 19 13:03:13 CEST 2013


The branch, build-main has been updated
       via  62675904dff3890b3cd24cc9d819d4040bd38530 (commit)
      from  7009b45598b63ddc76192f7fc87bc9a80b15e8bc (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:
 lib/x2gobroker-agent.pl |   22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

The diff of changes is:
diff --git a/lib/x2gobroker-agent.pl b/lib/x2gobroker-agent.pl
index 481de06..3155837 100755
--- a/lib/x2gobroker-agent.pl
+++ b/lib/x2gobroker-agent.pl
@@ -121,36 +121,28 @@ if( ($mode eq 'findbusyservers_by_sessionstats') || ($mode eq 'findbusyservers')
 
 	InitX2GoUser($uid, $uidNumber, $gidNumber, $home);
 	print "OK\n";
-	my $session_list = `/bin/su - -c \"x2golistsessions_root --all-servers\"`;
 	my $busy_servers = `/bin/su - $uid -c \"x2gogetservers\"`;
-	my $amount_sessions = 0;
 
-	# initialize server_load hash
 	my %server_load = ();
+	my $num_sessions = 0;
 	foreach (split('\n', $busy_servers))
 	{
-		$server_load{$_} = 0;
-	}
-
-	# count sessions per server
-	my @session_list = split(/\n/, $session_list);
-	foreach (@session_list)
-	{
-		my ($apid, $sid, $disp, $hostname, $stat, $dcreated, $cookie, $gport, $sndport, $dsusp, $username, $fsport) = split('\\|', $_);
-		$amount_sessions++;
-		$server_load{$hostname} += 1;
+		my ($hostname, $num_users) = split(' ', $_);
+		$server_load{$hostname} = $num_users;
+		$num_sessions += $num_users;
 	}
 
 	# render the output result
 	my @result;
 	for my $hostname ( keys %server_load ) {
-		my $available = $server_load{$hostname}/$amount_sessions*100;
+		my $available = $server_load{$hostname}/$num_sessions*100;
 		push @result, sprintf '%1$d:%2$s', $available, $hostname;
 	}
-	print join('\n', sort @result);
+	print join("\n", sort @result);
 	print "\n";
 }
 
+
 if($mode eq 'getservers')
 {
 	InitX2GoUser($uid, $uidNumber, $gidNumber, $home);


hooks/post-receive
-- 
x2gobroker.git (HTTP(S) Session broker for X2Go)

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 "x2gobroker.git" (HTTP(S) Session broker for X2Go).




More information about the x2go-commits mailing list