I want to set up a script that runs after my Linux starts up, and keep retrying (at an interval, say 1 minute) if fails. How do I do so?
Thanks!
I want to set up a script that runs after my Linux starts up, and keep retrying (at an interval, say 1 minute) if fails. How do I do so?
Thanks!
See this answer for how to run a script on startup. To keep retrying, write a wrapper for your script which determines if the script failed or not, and if it did, wait 1 minute then try again. It really depends what language you are writing in, so if you want more help, please provide more details.
You can create a loop with a bash script using these instructions.
i="0"
while [ $i -ne 1 ]
do
# Run your script here
# if script was successful, set $i to 1
sleep 60
done
while
loop you can use $?
to ask for the return status of your script, just after the line that runs it.