summaryrefslogtreecommitdiff
path: root/Mailman/bin/mailmanctl.py
diff options
context:
space:
mode:
authorBarry Warsaw2007-07-18 11:46:44 -0400
committerBarry Warsaw2007-07-18 11:46:44 -0400
commit50d84950d1060129da8eb3c3c490a7395b0837e5 (patch)
tree0902bb4b1a5c8f7caa05191e9de9d3d0f76fe648 /Mailman/bin/mailmanctl.py
parent012fcb71e7e634b985219a7d5cf0deda87a2aa90 (diff)
downloadmailman-50d84950d1060129da8eb3c3c490a7395b0837e5.tar.gz
mailman-50d84950d1060129da8eb3c3c490a7395b0837e5.tar.zst
mailman-50d84950d1060129da8eb3c3c490a7395b0837e5.zip
Diffstat (limited to 'Mailman/bin/mailmanctl.py')
-rw-r--r--Mailman/bin/mailmanctl.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/Mailman/bin/mailmanctl.py b/Mailman/bin/mailmanctl.py
index 6d3636501..78ae0c8e8 100644
--- a/Mailman/bin/mailmanctl.py
+++ b/Mailman/bin/mailmanctl.py
@@ -40,6 +40,9 @@ __i18n_templates__ = True
COMMASPACE = ', '
DOT = '.'
+# Calculate this here and now, because we're going to do a chdir later on, and
+# if the path is relative, the qrunner script won't be found.
+BIN_DIR = os.path.abspath(os.path.dirname(sys.argv[0]))
# Since we wake up once per day and refresh the lock, the LOCK_LIFETIME
# needn't be (much) longer than SNOOZE. We pad it 6 hours just to be safe.
@@ -252,10 +255,11 @@ def start_runner(qrname, slice, count):
#
# Craft the command line arguments for the exec() call.
rswitch = '--runner=%s:%d:%d' % (qrname, slice, count)
- exe = os.path.join(config.BIN_DIR, 'qrunner')
+ # Wherever mailmanctl lives, so too must live the qrunner script.
+ exe = os.path.join(BIN_DIR, 'qrunner')
# config.PYTHON, which is the absolute path to the Python interpreter,
# must be given as argv[0] due to Python's library search algorithm.
- args = [config.PYTHON, config.PYTHON, exe, rswitch, '-s']
+ args = [sys.executable, sys.executable, exe, rswitch, '-s']
if opts.config:
args.extend(['-C', opts.config])
os.execl(*args)
@@ -380,8 +384,8 @@ def main():
# won't be opening any terminal devices, don't do the ultra-paranoid
# suggestion of doing a second fork after the setsid() call.
os.setsid()
- # Instead of cd'ing to root, cd to the Mailman installation home
- os.chdir(config.PREFIX)
+ # Instead of cd'ing to root, cd to the Mailman runtime directory.
+ os.chdir(config.VAR_DIR)
# I don't think we have any unneeded file descriptors.
#
# Now start all the qrunners. This returns a dictionary where the