Lines 22-27
Link Here
|
22 |
import pkg_resources |
22 |
import pkg_resources |
23 |
import os |
23 |
import os |
24 |
import sys |
24 |
import sys |
|
|
25 |
import grp |
26 |
import pwd |
25 |
from SocketServer import ThreadingMixIn |
27 |
from SocketServer import ThreadingMixIn |
26 |
|
28 |
|
27 |
from trac import __version__ as VERSION |
29 |
from trac import __version__ as VERSION |
Lines 169-174
Link Here
|
169 |
parser.add_option('--pidfile', action='store', |
171 |
parser.add_option('--pidfile', action='store', |
170 |
dest='pidfile', |
172 |
dest='pidfile', |
171 |
help='When daemonizing, file to which to write pid') |
173 |
help='When daemonizing, file to which to write pid') |
|
|
174 |
parser.add_option('--user', action='store', |
175 |
dest='user', |
176 |
help='Drop privileges to user') |
177 |
parser.add_option('--group', action='store', |
178 |
dest='group', |
179 |
help='Drop privileges to group') |
172 |
parser.add_option('--umask', action='store', type='int', dest='umask', |
180 |
parser.add_option('--umask', action='store', type='int', dest='umask', |
173 |
metavar='MASK', |
181 |
metavar='MASK', |
174 |
help='When daemonizing, file mode creation mask ' |
182 |
help='When daemonizing, file mode creation mask ' |
Lines 244-249
Link Here
|
244 |
daemon.daemonize(pidfile=options.pidfile, progname='tracd', |
252 |
daemon.daemonize(pidfile=options.pidfile, progname='tracd', |
245 |
umask=options.umask) |
253 |
umask=options.umask) |
246 |
|
254 |
|
|
|
255 |
if options.group: |
256 |
os.setgid(grp.getgrnam(options.group)[2]) |
257 |
|
258 |
if options.user: |
259 |
os.setuid(pwd.getpwnam(options.user)[2]) |
260 |
|
247 |
if options.autoreload: |
261 |
if options.autoreload: |
248 |
def modification_callback(file): |
262 |
def modification_callback(file): |
249 |
print>>sys.stderr, 'Detected modification of %s, restarting.' \ |
263 |
print>>sys.stderr, 'Detected modification of %s, restarting.' \ |