I am trying to do a while loop that iterates 10 times to retry 2 consecutive commands;
Basically;
retries=10
while ((retries > 0)); do
if ! command; then
if ! other_command; then
echo "Failed to start service - retrying ${retries}"
else
echo "Started service successfully"
break
fi
fi
((retries --))
if ((retries == 0 )); then
echo "service failed to start!"
fi
done
But I cannot seem to nest it properly to get the desired result, which is; try one command, if it fails, try second command. Try these 2 commands, one after the other 10 times. If either command is successful at any time, break