I have a file
/opt/mailman/.bashrc
file with this line:
source /opt/mailman/venv/bin/activate
works quite well with systemd.
My service file looks like this:
[Unit] Description=GNU Mailing List Manager After=syslog.target network.target mysqld.service
[Service] Type=forking PIDFile=/opt/mailman/mm/var/master.pid Environment="MAILMAN_CONFIG_FILE=/etc/mailman3/mailman.cfg" User=mailman Group=mailman ExecStart=/opt/mailman/venv/bin/mailman start ExecReload=/opt/mailman/venv/bin/mailman restart ExecStop=/opt/mailman/venv/bin/mailman stop
[Install] WantedBy=multi-user.target
Eggert
Am Donnerstag, 20. Oktober 2022, 08:38:05 CEST schrieb Mark Sapiro:
On 10/19/22 21:23, Stephen J. Turnbull wrote:
Onyeibo Oku writes:
Mailman starts well from virtual environment though, ... but systemd doesn't replicate that success.
systemd doesn't know anything about venv. If it's possible to source (not call as a command!) the venv bin/activate script via systemd, that should fix it. If not, we'll have to figure out what it is that the venv provides that the current systemd config does not. I would guess that after sourcing the venv's bin/activate
Our suggested systemd script at https://docs.mailman3.org/en/latest/install/virtualenv.html#starting-mailman -automatically has
ExecStart=/opt/mailman/venv/bin/mailman start ExecReload=/opt/mailman/venv/bin/mailman restart ExecStop=/opt/mailman/venv/bin/mailman stop
/opt/mailman/venv/bin/mailman should work whether or not a venv is active.
Judging from the traceback, Onyeibo Oku's /opt/mailman/venv/bin/mailman is quite different from mine which is just
#!/opt/mailman/venv/bin/python3 # EASY-INSTALL-ENTRY-SCRIPT: 'mailman==3.3.5','console_scripts','mailman' __requires__ = 'mailman==3.3.5' import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit( load_entry_point('mailman==3.3.5', 'console_scripts', 'mailman')() )
What is yours? and can you start mailman as the mailman user with
/opt/mailman/venv/bin/mailman start
without activating the venv?