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.
So far I have used crontab @ reboot and adding rc.local service. Both did not work for me. Sometimes the video files would get saved but would not have any footage. They are saved as 0s duration video files with black screen, as if the code failed to access the camera stream.
Sometimes, 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.
I used these steps for rc.local method. I then added the script path to the rc.local file.
I have also tried adding the code in Startup Applications. Did not work.
It works perfectly fine if run the script manually etc. I run the code and the board is ready to receive serial commands and record videos.
I don’t know what I am doing wrong in executing these startup techniques but I think it’s something just very small that I am missing. I would like to know what I could be doing wrong.
Also, is there anything else I could use to achieve this that might work?