Skip to content

Commit

Permalink
Resurrect logreopen (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed Apr 15, 2015
1 parent b346f86 commit ae3cd74
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/zdaemon/tests/testzdctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def doctest_ZDCmd_help():
<BLANKLINE>
Documented commands (type help <topic>):
========================================
fg help logtail restart start stop
foreground kill reopen_transcript show status wait
fg help logreopen reopen_transcript show status wait
foreground kill logtail restart start stop
<BLANKLINE>
>>> run("help fg")
Expand All @@ -35,6 +35,10 @@ def doctest_ZDCmd_help():
kill [sig] -- Send signal sig to the daemon process.
The default signal is SIGTERM.
>>> run("help logreopen")
logreopen -- Send a SIGUSR2 signal to the daemon process.
This is designed to reopen the log file.
>>> run("help logtail")
logtail [logfile] -- Run tail -f on the given logfile.
A default file may exist.
Expand Down Expand Up @@ -71,4 +75,4 @@ def doctest_ZDCmd_help():


def test_suite():
return doctest.DocTestSuite()
return doctest.DocTestSuite(optionflags=doctest.NORMALIZE_WHITESPACE)
7 changes: 7 additions & 0 deletions src/zdaemon/zdctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,13 @@ def help_show(self):
print("show python -- show Python version and details")
print("show all -- show all of the above")

def do_logreopen(self, arg):
self.do_kill('USR2')

def help_logreopen(self):
print("logreopen -- Send a SIGUSR2 signal to the daemon process.")
print(" This is designed to reopen the log file.")

def do_logtail(self, arg):
if not arg:
arg = self.options.logfile
Expand Down

0 comments on commit ae3cd74

Please sign in to comment.