[X2go-Commits] x2gothinclient.git - master (branch) updated: c6a592e5b42a72e76f30c9d48005ee3cad0e676f

X2go dev team git-admin at x2go.org
Wed Jun 29 13:10:49 CEST 2011


The branch, master has been updated
       via  c6a592e5b42a72e76f30c9d48005ee3cad0e676f (commit)
      from  7241e5d56b095bd2986ae6d3ba45b93ab95ebb5b (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 -----------------------------------------------------------------
commit c6a592e5b42a72e76f30c9d48005ee3cad0e676f
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Jun 29 13:09:16 2011 +0200

    Improvement for CPU load fix (gets rid of defunct sh process)

-----------------------------------------------------------------------

Summary of changes:
 x2gothinclient/sbin/x2gothinclientd |   32 +++++++++++++++++++++-----------
 1 files changed, 21 insertions(+), 11 deletions(-)

The diff of changes is:
diff --git a/x2gothinclient/sbin/x2gothinclientd b/x2gothinclient/sbin/x2gothinclientd
index 62f6b2d..63e3984 100755
--- a/x2gothinclient/sbin/x2gothinclientd
+++ b/x2gothinclient/sbin/x2gothinclientd
@@ -20,6 +20,7 @@
 
 
 use strict;
+use IPC::Open3;
 
 sub catch_term
 {
@@ -69,19 +70,18 @@ system("su x2goclient -c \". /etc/x2go/x2gothinclient_init\"");
 my $pid = fork();
 if (not defined $pid) 
 {
-  print "resources not avilable.\n";
+	print "resources not avilable.\n";
 } 
 elsif ($pid != 0) 
 {
-    open (F,">/var/run/x2gothinclient.pid");
-    print F "$pid\n";
-    close(F);
+	open (F,">/var/run/x2gothinclient.pid");
+	print F "$pid\n";
+	close(F);
 }
 elsif ($pid == 0 )
 {
 
 	# silence this daemon script completely...
-	close(STDIN);
 	close(STDOUT);
 	close(STDERR);
 
@@ -91,21 +91,25 @@ elsif ($pid == 0 )
 	{
 
 		# test if XServer is running, if not launch it...
-		if ( check_x() ==0)    
+		if ( check_x() ==0 )
 		{
-			system("/usr/bin/Xorg -br&");
+			system("/usr/bin/Xorg -br &");
 		}
 
 		# test if pulseaudio is running, if not launch it...
-		if ( !check_pulse())
+		if ( !check_pulse() )
 		{
 			system("su - x2goclient -c \"DISPLAY=:0 pulseaudio -D -n -L 'module-native-protocol-tcp port=4713' -L 'module-esound-protocol-tcp port=16001' -L 'module-udev-detect'\"");
 		}
 
 		# test if x2goclient is running, if not launch it...
-		if ( !check_client())
+		my $x2goclient_pid = 0;
+		if ( !check_client() )
 		{
-			qx(su - x2goclient -c \"export DISPLAY=:0; . /etc/x2go/x2gothinclient_start\");
+			local *IN, *OUT, *ERR;
+			$x2goclient_pid = eval {
+				open3( \*IN, \*OUT, \*ERR, "su - x2goclient -c 'DISPLAY=:0 bash -c \"/etc/x2go/x2gothinclient_start &\"'");
+			};
 		}
 
 		# handle availability of the thinshutdown button GUI...
@@ -119,7 +123,13 @@ elsif ($pid == 0 )
 		}
 		if (  !$SHUTD && !$PROXY && $CLIENT)
 		{
-			system("bash -c 'sleep 4; DISPLAY=:0 thinshutdown &'");
+			system("sleep 4; DISPLAY=:0 thinshutdown &");
+		}
+
+		## wait for x2goclient to finish
+		if ( check_client() )
+		{
+			waitpid( $x2goclient_pid, 0 );
 		}
 	}
 }


hooks/post-receive
-- 
x2gothinclient.git (X2go Thin Client Environment)

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 "x2gothinclient.git" (X2go Thin Client Environment).




More information about the x2go-commits mailing list