I am making an image processing solution where the Raspberry Pi processes the image using a python script, and sends the result to an Arduino board. I want to keep this system always running, as Raspberry Pi has a Linux kernel, so is there any way to keep the python script on the pi always running?
Asked
Active
Viewed 5,690 times
2
-
2Linux should has `cron` to run programs periodically and then they don't have to run all the time. – furas Jan 05 '17 at 05:58
-
Possible duplicate of [How to make sure an application keeps running on Linux](https://stackoverflow.com/questions/298760/how-to-make-sure-an-application-keeps-running-on-linux) – João Almeida Jul 02 '19 at 09:56
2 Answers
2
It's not clear if the images will be stored on a folder or how your script will receive the images, but here are 2 options:
- Setup a cron job to run your script every X seconds/minutes, process all images available and send them to the arduino board
- Run your script in the background as a service, there are some cool instructions on the following link: http://blog.scphillips.com/posts/2013/07/getting-a-python-script-to-run-in-the-background-as-a-service-on-boot/

FelipeS
- 198
- 2
- 11
-3
If you keep terminal running forever, then you can simply use python's While condition
while True:
*do some thing*
and keep the program running as long as u need you can also use time module if you want it to sleep for few sec or mins

Bijoy
- 1,131
- 1
- 12
- 23