I am very new to shell scripting. I have written a script with help of this forum and some googling and it works the way I want it to. Currently this script checks for my SIP trunk registration every 5 seconds, if registration is not available then it reboots my router through telnet session and keeps rebooting it till the registration is available.
I would like the router rebooted only thrice at max and then wait for 10 minute, check for registration again and if failed then max 3 reboots and interval again.
However if the trunk registration is successful then script should keep checking it every 5 secs as per current practice.
So is what you are now asking for is a frequent poll and reboots at 10 minute intervals?
You have all you need really, you just have to adjust your logic and re-use what's been offered. Consider 600 seconds being a 120 x 5 second tests and code a loop accordingly. You'd be better trying and failing, then asking for help than asking for a ready made solution. You will then learn how things work and be better placed to support and adjust them in future.