Running Scripts on Startup

Caporegime
Joined
18 Oct 2002
Posts
25,287
Location
Lake District
Hi, I'm running Debian and want to start pyomxplayer and make it automatically restart if it crashes or ends. What is the best way to accomplish this? Someone and suggested to me using a simple forever script but what is this?
 
I'd guess they mean something like:
Code:
while true; do
./pyomxplayer
done

Periodically the program ends/crashes, then the loop just starts it again. Put the above in hash.sh then run './hack.sh &'.

The cleanest approach might be /etc/inittab.
 
Make sure to add a 'sleep 3' or something in the loop, otherwise if your stuff ever crash on startup, you'll bring the box down by restart-looping it.

But yeah the 'right' solution is /etc/inittab
 
Back
Top Bottom