Categories
programming Useful

Bash Infinite Loop raspberry pi

We are using a raspberry pi (with raspbian) to run a video file in a loop at www.dokodemoterebi.com, but this should work with any linux version.

Creating an infinite loop is very simple the following code will do the trick:

while true; do omxplayer /home/pi/myvideo.mp4; done

If you want it to run at start up, edit /etc/init.d/rc.local and copy the code above at the end of rc.local

Now you only need to power the pi and the video will run in an endless loop, log in or any input from the user is not necessary. Be careful as you will be locked out if you do this. If you need to change something in the future you can plug the disk into another linux machine or use ssh.