[Zodb-checkins] SVN: zdaemon/trunk/ add a "transcript" setting to
specify a file that all program output is
Fred L. Drake, Jr.
fdrake at gmail.com
Thu Aug 5 14:58:56 EDT 2004
Log message for revision 26920:
add a "transcript" setting to specify a file that all program output is
written to in daemon mode
(addresses Zope 3 issue 245)
Changed:
U zdaemon/trunk/component.xml
U zdaemon/trunk/zdrun.py
-=-
Modified: zdaemon/trunk/component.xml
===================================================================
--- zdaemon/trunk/component.xml 2004-08-05 18:57:13 UTC (rev 26919)
+++ zdaemon/trunk/component.xml 2004-08-05 18:58:56 UTC (rev 26920)
@@ -250,6 +250,18 @@
</description>
</key>
+ <key name="transcript" datatype="existing-dirpath"
+ required="no">
+ <description>
+ The name of a file in which a transcript of all output from
+ the command being run will be written to when daemonized.
+
+ If not specified, output from the command will be discarded.
+
+ This only takes effect when the "daemon" option is enabled.
+ </description>
+ </key>
+
<key name="prompt" datatype="string"
required="no">
<description>
Modified: zdaemon/trunk/zdrun.py
===================================================================
--- zdaemon/trunk/zdrun.py 2004-08-05 18:57:13 UTC (rev 26919)
+++ zdaemon/trunk/zdrun.py 2004-08-05 18:58:56 UTC (rev 26920)
@@ -26,6 +26,7 @@
-s/--socket-name SOCKET -- Unix socket name for client (default "zdsock")
-u/--user USER -- run as this user (or numeric uid)
-m/--umask UMASK -- use this umask for daemon subprocess (default is 022)
+-t/--transcript FILE -- transript of output from daemon-mode program
-x/--exit-codes LIST -- list of fatal exit codes (default "0,2")
-z/--directory DIRECTORY -- directory to chdir to when using -d (default off)
program [program-arguments] -- an arbitrary application to run
@@ -97,6 +98,8 @@
self.add("schemafile", short="S:", long="schema=",
default="schema.xml",
handler=self.set_schemafile)
+ self.add("transcript", "runner.transcript", "t:", "transcript=",
+ default="/dev/null")
def set_schemafile(self, file):
self.schemafile = file
@@ -348,7 +351,7 @@
# parent terminal window to escape from a logtail command.
# To disassociate ourselves from our parent's session group we use
# os.setsid. It means "set session id", which has the effect of
- # disassociating a process from its current session and process group
+ # disassociating a process from is current session and process group
# and setting itself up as a new session leader.
#
# Unfortunately we cannot call setsid if we're already a session group
@@ -380,9 +383,9 @@
os.close(0)
sys.stdin = sys.__stdin__ = open("/dev/null")
os.close(1)
- sys.stdout = sys.__stdout__ = open("/dev/null", "w")
+ sys.stdout = sys.__stdout__ = open(self.options.transcript, "a", 0)
os.close(2)
- sys.stderr = sys.__stderr__ = open("/dev/null", "w")
+ sys.stderr = sys.__stderr__ = open(self.options.transcript, "a", 0)
os.setsid()
os.umask(self.options.umask)
# XXX Stevens, in his Advanced Unix book, section 13.3 (page
More information about the Zodb-checkins
mailing list