I have a shell script:
#!/bin/bash while sudo /home/pi/MyCode; do :; done echo Error with MyCode
which runs a program in an infinite loop. I want to set up the shell script to run at start-up (which I've done with other bash scripts). However, I don't want the script to halt start-up, or prevent me from being to ssh in.
I've seen a lot of people who have had to wipe and remount their SD cards due to infinite loops be created on start-up. How do I prevent this?
I've tried augmenting the code:
#!/bin/bash while sudo /home/pi/MyCode &; do :; done echo Error with MyCode
to run MyCode in the background, but I keep getting an error along the lines
unexpected character before ;
Is there a way to run this script on startup without halting my startup? If so, can it be done in a way that I still have the option of SSH'ing and stopping the script at any time?