[#801] Added a quick hack to write a PID to a file

Date:
2008-10-22 10:54
Priority:
3
State:
Open
Submitted by:
Stephan Holl (sholl)
Assigned to:
Bernhard Herzog (bh)
Component:
none
Version:
none
Resolution:
none
Summary:
Added a quick hack to write a PID to a file

Detailed description
I have added a quick hack to support a PID-file, so that the server can be used within normal init-scripts on Linux.

This patch assumes that osaas is installed under /opt/gispatcher/osaas-server which will be the case in my work. See next patch.

What is missing:
* nearly all needed PID-file-handling like removing, removing stale PID-files etc...

Index: server/startosaas.py
===================================================================
--- server/startosaas.py (Revision 37)
+++ server/startosaas.py (Arbeitskopie)
@@ -7,6 +7,14 @@
# Read the file GPL.txt coming with the software for details.

from osaas.run import main
+import os

+
if __name__ == "__main__":
+ print os.getpid()
+ pidfile = "/opt/gispatcher/osaas-server/osaas.pid"
+ f = open(pidfile, "w")
+ f.write("%d" % os.getpid())
+ f.close()
+
main()
Message  ↓
Date: 2008-11-21 16:22
Sender: Bernhard Herzog

Revision 47 contains a more elaborate form of the patch. The name of the pid file can be specified on the command line or in the configuration file. The file is automatically deleted when the server is stopped, at least when stopping is done via keyboard interrupt or SIGTERM.

Not implemented:
- Detecting an already running server

No attached documents

Field Old Value Date By
assigned_tonone2008-11-19 10:12Stephan Holl