How to restart the program when it is closed on Jetson Nano

Hello!
I’m currently using Jetson Nano 2GB. In addition, real-time detection codes were created using TensorRT and Pytorch.
I made the demo.py file run using rc.local to make it run automatically when Jetson is powered. But there was a problem. Currently, the camera is turned off due to an error in the middle or stopped because the program is not perfect. To this end, is there a good way to make Python program run again when it is over?

The method I thought of is as follows.

  • Write a code that causes reboot when an exception occurs through exception processing in Python code.

Is there any other good way?
For example, if the program turns off in the middle, I wonder if there is a good way to redo it or to handle exceptions.

Thanks!

You can try systemd, but need to start it after nvargus-daemon service.

1 Like

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