Mercurial > p > roundup > code
changeset 3784:93dfda74a763
allow use of roundup-server pidfile without forking [SF#1614753]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 18 Dec 2006 03:53:39 +0000 |
| parents | 19d1e674768b |
| children | edefe9ccfbba |
| files | CHANGES.txt roundup/configuration.py roundup/scripts/roundup_server.py |
| diffstat | 3 files changed, 20 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Mon Dec 18 03:51:44 2006 +0000 +++ b/CHANGES.txt Mon Dec 18 03:53:39 2006 +0000 @@ -15,6 +15,7 @@ - HTMLClass fixed to work with new item permissions check (sf bug 1602983) - support POP over SSL (sf patch 1597703) - clean up input field generation and quoting of values (sf bug 1615616) +- allow use of roundup-server pidfile without forking (sf bug 1614753) 2006-11-11 1.3.1
--- a/roundup/configuration.py Mon Dec 18 03:51:44 2006 +0000 +++ b/roundup/configuration.py Mon Dec 18 03:53:39 2006 +0000 @@ -1,6 +1,6 @@ # Roundup Issue Tracker configuration support # -# $Id: configuration.py,v 1.37 2006-12-11 23:36:15 richard Exp $ +# $Id: configuration.py,v 1.38 2006-12-18 03:53:39 richard Exp $ # __docformat__ = "restructuredtext" @@ -482,6 +482,8 @@ (TimezoneOption, "timezone", "UTC", "Default timezone offset," " applied when user's timezone is not set.", ["DEFAULT_TIMEZONE"]), + (BooleanOption, "nodaemon", "no", + "don't fork (this overrides the pidfile automatism).'"), (BooleanOption, "instant_registration", "no", "Register new users instantly, or require confirmation via\n" "email?"),
--- a/roundup/scripts/roundup_server.py Mon Dec 18 03:51:44 2006 +0000 +++ b/roundup/scripts/roundup_server.py Mon Dec 18 03:53:39 2006 +0000 @@ -17,7 +17,7 @@ """Command-line script that runs a server over roundup.cgi.client. -$Id: roundup_server.py,v 1.85 2006-11-09 00:36:21 richard Exp $ +$Id: roundup_server.py,v 1.86 2006-12-18 03:53:39 richard Exp $ """ __docformat__ = 'restructuredtext' @@ -378,6 +378,8 @@ "In order to use this option, " "the server must be run initially as root.\n" "Availability: Unix."), + (configuration.BooleanOption, "nodaemon", "no", + "don't fork (this overrides the pidfile mechanism)'"), (configuration.BooleanOption, "log_hostnames", "no", "Log client machine names instead of IP addresses " "(much slower)"), @@ -408,6 +410,7 @@ "user": "u:", "logfile": "l:", "pidfile": "d:", + "nodaemon": "D", "log_hostnames": "N", "multiprocess": "t:", } @@ -638,6 +641,14 @@ } +def writepidfile(pidfile): + ''' Write a pidfile (only). Do not daemonize. ''' + pid = os.getpid() + if pid: + pidfile = open(pidfile, 'w') + pidfile.write(str(pid)) + pidfile.close() + def daemonize(pidfile): ''' Turn this process into a daemon. - make sure the sys.std(in|out|err) are completely cut off @@ -763,7 +774,10 @@ " on this Operating System") sys.exit(0) else: - daemonize(config["PIDFILE"]) + if config['NODAEMON']: + writepidfile(config["PIDFILE"]) + else: + daemonize(config["PIDFILE"]) # create the server httpd = config.get_server()
