use systemd for service

To use systemd to start your service based on ourobori use a service-file in /etc/systemd/system/<servicename>.service with content like the following:

[Unit]
Description=<some short description for your service>
After=network.target

[Service]
Restart=always
RestartSec=3
WorkingDirectory=<BASEDIR>
Environment="PYTHONPATH=<BASEDIR>"
ExecStart=<PYTHON_INTERPRETER> <SERVICE_PY> <ARGS>

[Install]
Alias=<name of your service>
WantedBy=multi-user.target

Legend:

  • <BASEDIR>: absolute path of basedir of the service.
  • <PYTHON_INTERPRETER>: absolute path to the python interpreter of the conda-environment of the service.
  • <SERVICE_PY>: absolute path to the service.py file of the service.
  • <ARGS>: Additional args for the service-start like –debug or –mode=prod.

To enable your service for systemd use:

systemctl enable <servicename>.service

To start it use:

systemctl start <servicename>.service

To restart after changes use:

systemctl restart <servicename>.service