Run python script with camera/gstreamer pipeline on startup using .service

I followed some tutorials to create a .service file:

[Unit]
Description=camera
After=graphical.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/python3 /home/USER/projects/camera.py

[Install]
WantedBy=graphical.target

My camera.py uses gstreamer and opencv to run a camera feed. I want this to run on startup. I’ve run:

sudo systemctl daemon-reload
sudo systemctl enable camera.service
sudo systemctl start camera.service

at this point when I run systemctl status halo.service it says that the script is active but nothing happens. Then when I run sudo reboot and restart my Jetson, the halo.service is inactive (dead). How can I get this working on startup?

This is the tutorial I followed: Creating a Linux service with systemd | by Benjamin Morel | Medium

Hi,
We have tried to enable rc.local and it works OK. Please refer to this post and give it a try:
omxh264enc and nvvidconv NOT working unless... - #22 by DaneLLL

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