I have a Python code on NVIDIA Jetson TX@ (running Ubuntu 18.04) that records videos upon receiving commands (via serial communication with another hardware). The recording is done by the IP camera connected to the Ethernet Port of NVIDIA Jetson TX2. The video files are saved at the same path where the Python code is.
I would like to have the python code run on startup as soon as the board is booted.
The code stops running after the first serial command is sent. So if I want to send another command, it won’t work because the code isn’t running anymore upon checking ps -ax|grep python3. However, when I first boot Jetson, the process does show running. It just stops after the first serial communication.
My code is in /usr/bin/dummy_service.py .
Here is the systemd service configuration. I have named my service dummy.service:
> GNU nano 2.9.3 /lib/systemd/system/dummy.service
[Unit] Description=Dummy Service After=multi-user.target Conflictsfirstname.lastname@example.org [Service] Type=simple ExecStart=/usr/bin/python3 /usr/bin/dummy_service.py StandardInput=tty-force [Install] WantedBy=multi-user.target
If I check the status of the service after the code has stopped on it’s own after the first camera operation command, I get this:
sudo systemctl status dummy.service
● dummy.service - Dummy Service Loaded: loaded (/lib/systemd/system/dummy.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2020-11-12 19:42:44 IST; 22s ago Process: 7337 ExecStart=/usr/bin/python3 /usr/bin/dummy_service.py (code=exited, status=1/FAILURE) Main PID: 7337 (code=exited, status=1/FAILURE) Nov 12 19:41:57 jetson-desktop systemd: Started Dummy Service. Nov 12 19:42:44 jetson-desktop systemd: dummy.service: Main process exited, code=exited, status=1/FAILURE Nov 12 19:42:44 jetson-desktop systemd: dummy.service: Failed with result 'exit-code'.
Any insights? I’m not sure what I’m doing wrong.