Set up trytond as a service in venv

Hello fellow friends,

I’m trying to set up a number of trytond servers in multiple VENVs, using an ubuntu server. To keep them up, it would be nice to run them as system services. So I tried to create a /etc/systemd/system/my-trytond.service, inspired by a number of web hits, containing as follows:

[Unit]
Description=start my-trytond
After=network.target
After=postgresql.service
StartLimitIntervalSec=5

[Service]
Type=simple
RestartSec=5
User=wd
ExecStartPre= /usr/bin/bash -c 'cd /home/path-to-my-venv/my-trytond && source bin/activate'
ExecStart= /usr/bin/python /home/path-to-my-venv/my-trytond/bin/trytond -c /home/path-to-my-venv/my-trytond/trytond.conf -d my-database
Restart=on-failure

[Install]
WantedBy=multi-user.target

The ExecStartPre part seems to be successful, the ExecStart bit fails with (code=exited, status=1/FAILURE).

Could somebody tell me how to make it work?

Thanks a lot in advance, Wolf

ExecStart= /usr/bin/python /home/path-to-my-venv/my-trytond/bin/trytond -c /home/path-to-my-venv/my-trytond/trytond.conf -d my-database

You use the system python to start. Why not using

ExecStart= /home/path-to-my-venv/my-trytond/bin/python /home/path-to-my-venv/my-trytond/bin/trytond -c /home/path-to-my-venv/my-trytond/trytond.conf -d my-database

OTOH bin/trytond can usually be called directly:

ExecStart= /home/path-to-my-venv/my-trytond/bin/trytond -c /home/path-to-my-venv/my-trytond/trytond.conf -d my-database

Actually, this worked. I tried many versions, but skipped that step… ):
Thank you, Udo!

Cheers,
Wolf

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.