| Request | MaildropHost -- feature request -- by Michael Dunstan |
| Posted on | Oct 21, 2007 4:18 am |
| Subscribe |
| Resolve by Jens Vagelpohl on Nov 11, 2007 2:29 pm | |
|
Thanks for the patch, I just checked it in: http://svn.dataflake.org/?view=rev&revision=1436 |
|
|
|
| Initial Request by Michael Dunstan on Oct 21, 2007 4:18 am | |
|
It would be useful to have a mode for maildrop.py where it did not detach from the shell and did print debug messages. Not detaching from the shell is a requirement for running under the supervision of daemon tools. Here is a patch against MaildropHost 1.20: diff -r -u MaildropHost-1.20/config.py MaildropHost/config.py --- MaildropHost-1.20/config.py 2007-10-21 21:11:30.000000000 +1300 +++ MaildropHost/config.py 2007-10-21 21:17:55.000000000 +1300 @@ -81,3 +81,7 @@ # reject mail without this header. ADD_MESSAGEID=0 +# Set daemon supervision mode. This will prevent the daemon from +# detaching from the controlling terminal which is what you want if +# you using something like daemontools to supervise the daemon. +SUPERVISED_DAEMON=0 diff -r -u MaildropHost-1.20/maildrop/maildrop.py MaildropHost/maildrop/maildrop.py --- MaildropHost-1.20/maildrop/maildrop.py 2007-10-21 21:11:46.000000000 +1300 +++ MaildropHost/maildrop/maildrop.py 2007-10-21 21:16:23.000000000 +1300 @@ -241,6 +241,7 @@ from config import SMTP_PORT from config import DEBUG from config import WAIT_INTERVAL + from config import SUPERVISED_DAEMON # Windows does not support the detaching process below, so it is # always forced into debug mode. @@ -302,7 +303,7 @@ sys.exit(1) - if not DEBUG: + if not (DEBUG or SUPERVISED_DAEMON): # Do the Unix double-fork magic; see Stevens's book "Advanced # Programming in the UNIX Environment" (Addison-Wesley) for details # In DEBUG mode we do not fork/detach from the terminal! @@ -334,7 +335,7 @@ print >>sys.stderr, "fork #2 failed: %d (%s)" % ( e.errno, e.strerror) sys.exit(1) - else: + else DEBUG: print '***** Starting in DEBUG mode *****' print '***** All log messages are shown on the console *****' sys.stdout.flush() |