retry every n minutes if internet connection is not available #168
-
Like my previous question, I don't know if this can already be done or is yet to be implemented. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi, that's a good question! The plugin itself does not have any mechanism for trying execution again every few minutes if the execution fails. What you could do however, is to write a shell command that contains a loop that tries to call a command multiple times until it succeeds. The loop would have a May I ask you what shell you are using? Here is a guide on how to find out what shell you are using if you don't know it. In case you happen to be using Bash, you could have the following kind of shell command set: for counter in {1..10}; do echo "Try #"$counter"..."; wget "https://github.com" -O "outputfile.html"; if [$? -eq 0]; then break; fi; echo "Failed, will sleep for 5 minutes before retrying."; sleep 5m; done
No output during the processA not so optimal thing in this is that when the loop can take a long time to run, you cannot easily monitor how the process is going. If you One workaround is of course to use Make the shell command easier to readThe shell command is quite long as a single line version. for counter in {1..10};
do
echo "Try #"$counter"..."; wget "https://github.com" -O "outputfile.html";
if [$? -eq 0];
then
break;
fi;
echo "Failed, will sleep for 5 minutes before retrying.";
sleep 5m;
done
|
Beta Was this translation helpful? Give feedback.
Hi, that's a good question!
The plugin itself does not have any mechanism for trying execution again every few minutes if the execution fails. What you could do however, is to write a shell command that contains a loop that tries to call a command multiple times until it succeeds. The loop would have a
sleep
command too, that would introduce a five minutes pause between command calls, and also a counter that stops the loop in case the network connection does not recover after e.g. 10 tries (= 10 * 5 minutes = trying to call the command for 50 minutes).May I ask you what shell you are using? Here is a guide on how to find out what shell you are using if you don't know it. In case you happ…