[X2Go-Commits] x2gobroker.git - master (branch) updated: 0.0.2.3-133-ge488cf4

X2Go dev team git-admin at x2go.org
Fri Dec 20 13:25:20 CET 2013


The branch, master has been updated
       via  e488cf4b69f877fd0fe83caf39fbd36bcb33367e (commit)
      from  fc425cac66ea58ae30505ce5a9bb1cf89feab548 (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 e488cf4b69f877fd0fe83caf39fbd36bcb33367e
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Dec 20 13:25:16 2013 +0100

    really write a PID file containing the current process's PID

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

Summary of changes:
 bin/x2gobroker              |    7 ++++++-
 sbin/x2gobroker-authservice |    7 +++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

The diff of changes is:
diff --git a/bin/x2gobroker b/bin/x2gobroker
index 0cc7365..8e54b27 100755
--- a/bin/x2gobroker
+++ b/bin/x2gobroker
@@ -26,7 +26,7 @@ import sys
 import argparse
 import socket
 import logging
-import thread
+import atexit
 
 try:
     import daemon
@@ -76,6 +76,9 @@ def logfile_prelude():
     logger_broker.info('  X2GOBROKER_SSL_CERTFILE: {value}'.format(value=x2gobroker.defaults.X2GOBROKER_SSL_CERTFILE))
     logger_broker.info('  X2GOBROKER_SSL_KEYFILE: {value}'.format(value=x2gobroker.defaults.X2GOBROKER_SSL_KEYFILE))
 
+def cleanup_on_exit():
+    try: os.remove(pidfile)
+    except: pass
 
 try:
     import x2gobroker.defaults
@@ -269,9 +272,11 @@ if __name__ == "__main__":
             http_server.listen(bind_port, address=bind_address)
 
             if CAN_DAEMONIZE and cmdline_args.daemonize:
+                atexit.register(cleanup_on_exit)
                 keep_fds = [int(fd) for fd in os.listdir('/proc/self/fd') if fd not in (0,1,2) ]
                 daemon_stdout = file(daemon_logdir+'x2gobroker-daemon.stdout', 'w+')
                 daemon_stderr = file(daemon_logdir+'x2gobroker-daemon.stderr', 'w+')
+                file(pidfile, 'w+').write(str(os.getpid()))
                 with daemon.DaemonContext(stdout=daemon_stdout, stderr=daemon_stderr, files_preserve=keep_fds, umask=0o027, pidfile=lockfile.FileLock(pidfile)):
                     launch_ioloop()
             else:
diff --git a/sbin/x2gobroker-authservice b/sbin/x2gobroker-authservice
index 574e41e..ff9bbff 100755
--- a/sbin/x2gobroker-authservice
+++ b/sbin/x2gobroker-authservice
@@ -106,8 +106,10 @@ def loop():
     asyncore.loop()
 
 
-def cleanup_socketfile():
+def cleanup_on_exit():
     os.remove(X2GOBROKER_AUTHSERVICE_SOCKET)
+    try: os.remove(pidfile)
+    except: pass
 
 
 # normally this would go into defaults.py, however, we do not want to pull in defaults.py here as that will create
@@ -232,12 +234,13 @@ if __name__ == '__main__':
 
     socket_file = cmdline_args.socket_file
     AuthService(socket_file, owner=cmdline_args.owner, group_owner=cmdline_args.group, permissions=cmdline_args.permissions)
-    atexit.register(cleanup_socketfile)
+    atexit.register(cleanup_on_exit)
     try:
         if CAN_DAEMONIZE and cmdline_args.daemonize:
             keep_fds = [int(fd) for fd in os.listdir('/proc/self/fd') if fd not in (0,1,2) ]
             daemon_stdout = file(daemon_logdir+'x2gobroker-authservice.stdout', 'w+')
             daemon_stderr = file(daemon_logdir+'x2gobroker-authservice.stderr', 'w+')
+            file(pidfile, 'w+').write(str(os.getpid()))
             with daemon.DaemonContext(stdout=daemon_stdout, stderr=daemon_stderr, files_preserve=keep_fds, umask=0o027, pidfile=lockfile.FileLock(pidfile)):
                 loop()
         else:


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