summaryrefslogtreecommitdiff
path: root/Mailman/bin/mailmanctl.py
diff options
context:
space:
mode:
authorBarry Warsaw2007-07-21 16:19:54 -0400
committerBarry Warsaw2007-07-21 16:19:54 -0400
commit276009e248e64cf0c60989c93b2f3d6b9713c199 (patch)
tree7b630f12e1b0feaa8cc9f77e9d11188629e2b8d2 /Mailman/bin/mailmanctl.py
parent61d8ec7117463493b946c0f82872fe716d7bc901 (diff)
parenta55d4aa436f34e5d3f1e0e06b372b57de323aa61 (diff)
downloadmailman-276009e248e64cf0c60989c93b2f3d6b9713c199.tar.gz
mailman-276009e248e64cf0c60989c93b2f3d6b9713c199.tar.zst
mailman-276009e248e64cf0c60989c93b2f3d6b9713c199.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