[X2Go-Commits] [x2goserver] 06/07: x2goserver/sbin/x2gocleansessions: move socket and lock file cleanup into time-based block for finished/failed sessions.

git-admin at x2go.org git-admin at x2go.org
Tue Jun 23 01:32:05 CEST 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit b44bc574da2f6fb07608becf4d959ae2a0fa928d
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Tue Jun 23 00:05:25 2015 +0200

    x2goserver/sbin/x2gocleansessions: move socket and lock file cleanup into time-based block for finished/failed sessions.
    
    Cherry-picked from release/4.0.1.x branch.
---
 debian/changelog                  |    2 ++
 x2goserver/sbin/x2gocleansessions |   31 ++++++++++++++++---------------
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7cf1ff6..0bbc9f6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -214,6 +214,8 @@ x2goserver (4.0.1.20-0x2go1) UNRELEASED; urgency=low
     - x2goserver/sbin/x2gocleansessions: whitespace only.
     - x2goserver/sbin/x2gocleansessions: also delete entries in the other,
       overlooked hashes.
+    - x2goserver/sbin/x2gocleansessions: move socket and lock file cleanup
+      into time-based block for finished/failed sessions.
   * x2goserver.spec:
     - Add sudo and logcheck as BuildRequires and Requires. Don't own
       directories that are owned by sudo and logcheck. Logcheck is not
diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions
index d6a003b..f44f841 100755
--- a/x2goserver/sbin/x2gocleansessions
+++ b/x2goserver/sbin/x2gocleansessions
@@ -222,22 +222,23 @@ elsif ($pid == 0 )
 					delete $remembered_sessions_status{@sinfo[1]};
 					delete $remembered_sessions_status_since_time{@sinfo[1]};
 					delete $remembered_sessions_status_since_iterations{@sinfo[1]};
+
+					my $display = @sinfo[2];
+					if (-S "/tmp/.X11-unix/X$display") {
+						# remove the NX-X11 socket file (as the agent will not have managed after a kill -9)
+						log_message('warning', "@sinfo[1], pid @sinfo[0]: cleaning up stale X11 socket file: /tmp/.X11-unix/X$display");
+						unlink("/tmp/.X11-unix/X$display");
+					}
+					if (-e "/tmp/.X$display-lock") {
+						# remove the NX-X11 lock file (as the agent will not have managed after a kill -9)
+						log_message('warning', "@sinfo[1], pid @sinfo[0]: cleaning up stale X11 lock file: /tmp/.X$display-lock");
+						unlink("/tmp/.X$display-lock");
+					}
+					log_message('debug', "@sinfo[1]: unmounting all shares");
+					system( "su", "@sinfo[11]", "-s", "/bin/sh", "-c", "export HOSTNAME && x2goumount-session @sinfo[1]");
+					#remove port forwarding
+					system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "$x2go_lib_path/x2gormforward @sinfo[1]");
 				}
-				my $display = @sinfo[2];
-				if (-S "/tmp/.X11-unix/X$display") {
-					# remove the NX-X11 socket file (as the agent will not have managed after a kill -9)
-					log_message('warning', "@sinfo[1], pid @sinfo[0]: cleaning up stale X11 socket file: /tmp/.X11-unix/X$display");
-					unlink("/tmp/.X11-unix/X$display");
-				}
-				if (-e "/tmp/.X$display-lock") {
-					# remove the NX-X11 lock file (as the agent will not have managed after a kill -9)
-					log_message('warning', "@sinfo[1], pid @sinfo[0]: cleaning up stale X11 lock file: /tmp/.X$display-lock");
-					unlink("/tmp/.X$display-lock");
-				}
-				log_message('debug', "@sinfo[1]: unmounting all shares");
-				system( "su", "@sinfo[11]", "-s", "/bin/sh", "-c", "export HOSTNAME && x2goumount-session @sinfo[1]");
-				#remove port forwarding
-				system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "$x2go_lib_path/x2gormforward @sinfo[1]");
 			}
 			elsif (! check_pid (@sinfo[0], at sinfo[1], at sinfo[12]))
 			{

--
Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list