I am creating a
systemctl service for a python script which needs
openvino environment initialized. Before running the python script, we have to initialize the
openvino environment and have to run the python script from the same terminal in order to run it otherwise it will throw error. I have created below service for this:
[Unit] Description=Launch application [Service] User=john WorkingDirectory=/home/thingtrax/Documents/ThingTraxVisionPython Environment=DISPLAY=:0 ExecStartPre=/opt/intel/openvino/bin/setupvars.sh ExecStart=/usr/bin/python3 /home/john/Documents/ThingTraxVisionPython/rtsp_ttfr.py Restart=on-failure RestartSec=30s [Install] WantedBy=graphical.target
Now as per my understanding, I am using
ExecStartPre to initialize the openvino environment. OpenVino environment can not be initialized with root user and because we normally run systemctl service using root and this is why the python script is giving errors related to environment not initialized.
Is there any way we can mention everything to be run under john user. Please help. Thanks