How I need to create retry shell script to retry the timedout ones? [on hold]
Clash Royale CLAN TAG#URR8PPP
up vote
-1
down vote
favorite
I have few timeout project_Id's in the sql table and I need to write a shell script to retry those timed out project_id's.How can I do this mechanism as I am new to shell script and how I need to call my php file in .sh file to do retry.
I have written .sh file some this like this by reference of some links.
Retry.sh
#!/bin/bash
# Retries a command on failure.
# $1 - the max number of attempts
# $2... - the command to run
retry()
local -r -i max_attempts="$1"; shift
local -r cmd="$@"
local -i attempt_num=1
until $cmd
do
if (( attempt_num == max_attempts ))
then
echo "Attempt $attempt_num failed and there are no more attempts left!"
return 1
else
echo "Attempt $attempt_num failed! Trying again in $attempt_num seconds..."
sleep $(( attempt_num++ ))
fi
done
shell-script php
New contributor
put on hold as unclear what you're asking by Filipe Brandenburger, Rui F Ribeiro, Jeff Schaller, JigglyNaga, RalfFriedl 11 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |Â
up vote
-1
down vote
favorite
I have few timeout project_Id's in the sql table and I need to write a shell script to retry those timed out project_id's.How can I do this mechanism as I am new to shell script and how I need to call my php file in .sh file to do retry.
I have written .sh file some this like this by reference of some links.
Retry.sh
#!/bin/bash
# Retries a command on failure.
# $1 - the max number of attempts
# $2... - the command to run
retry()
local -r -i max_attempts="$1"; shift
local -r cmd="$@"
local -i attempt_num=1
until $cmd
do
if (( attempt_num == max_attempts ))
then
echo "Attempt $attempt_num failed and there are no more attempts left!"
return 1
else
echo "Attempt $attempt_num failed! Trying again in $attempt_num seconds..."
sleep $(( attempt_num++ ))
fi
done
shell-script php
New contributor
put on hold as unclear what you're asking by Filipe Brandenburger, Rui F Ribeiro, Jeff Schaller, JigglyNaga, RalfFriedl 11 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
What failed ids? What SQL? What DB? How are they failing (exact error message)? Linking shell scripts to web php is generally a bad idea. Saving data to a tmpfile is probably a way to leave it to and admin to recover later.
â danblack
20 hours ago
we are inserting the failed project_id's in separate table.We need to retry those Failed project_id's.How can I do this using shell script or with PHP. Please suggest me
â Ravin
20 hours ago
If it failed on the first attempt, why would it work when you retry? Please edit the question to show any error messages you're seeing.
â JigglyNaga
16 hours ago
add a comment |Â
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have few timeout project_Id's in the sql table and I need to write a shell script to retry those timed out project_id's.How can I do this mechanism as I am new to shell script and how I need to call my php file in .sh file to do retry.
I have written .sh file some this like this by reference of some links.
Retry.sh
#!/bin/bash
# Retries a command on failure.
# $1 - the max number of attempts
# $2... - the command to run
retry()
local -r -i max_attempts="$1"; shift
local -r cmd="$@"
local -i attempt_num=1
until $cmd
do
if (( attempt_num == max_attempts ))
then
echo "Attempt $attempt_num failed and there are no more attempts left!"
return 1
else
echo "Attempt $attempt_num failed! Trying again in $attempt_num seconds..."
sleep $(( attempt_num++ ))
fi
done
shell-script php
New contributor
I have few timeout project_Id's in the sql table and I need to write a shell script to retry those timed out project_id's.How can I do this mechanism as I am new to shell script and how I need to call my php file in .sh file to do retry.
I have written .sh file some this like this by reference of some links.
Retry.sh
#!/bin/bash
# Retries a command on failure.
# $1 - the max number of attempts
# $2... - the command to run
retry()
local -r -i max_attempts="$1"; shift
local -r cmd="$@"
local -i attempt_num=1
until $cmd
do
if (( attempt_num == max_attempts ))
then
echo "Attempt $attempt_num failed and there are no more attempts left!"
return 1
else
echo "Attempt $attempt_num failed! Trying again in $attempt_num seconds..."
sleep $(( attempt_num++ ))
fi
done
shell-script php
shell-script php
New contributor
New contributor
edited 38 mins ago
New contributor
asked yesterday
Ravin
11
11
New contributor
New contributor
put on hold as unclear what you're asking by Filipe Brandenburger, Rui F Ribeiro, Jeff Schaller, JigglyNaga, RalfFriedl 11 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as unclear what you're asking by Filipe Brandenburger, Rui F Ribeiro, Jeff Schaller, JigglyNaga, RalfFriedl 11 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
What failed ids? What SQL? What DB? How are they failing (exact error message)? Linking shell scripts to web php is generally a bad idea. Saving data to a tmpfile is probably a way to leave it to and admin to recover later.
â danblack
20 hours ago
we are inserting the failed project_id's in separate table.We need to retry those Failed project_id's.How can I do this using shell script or with PHP. Please suggest me
â Ravin
20 hours ago
If it failed on the first attempt, why would it work when you retry? Please edit the question to show any error messages you're seeing.
â JigglyNaga
16 hours ago
add a comment |Â
1
What failed ids? What SQL? What DB? How are they failing (exact error message)? Linking shell scripts to web php is generally a bad idea. Saving data to a tmpfile is probably a way to leave it to and admin to recover later.
â danblack
20 hours ago
we are inserting the failed project_id's in separate table.We need to retry those Failed project_id's.How can I do this using shell script or with PHP. Please suggest me
â Ravin
20 hours ago
If it failed on the first attempt, why would it work when you retry? Please edit the question to show any error messages you're seeing.
â JigglyNaga
16 hours ago
1
1
What failed ids? What SQL? What DB? How are they failing (exact error message)? Linking shell scripts to web php is generally a bad idea. Saving data to a tmpfile is probably a way to leave it to and admin to recover later.
â danblack
20 hours ago
What failed ids? What SQL? What DB? How are they failing (exact error message)? Linking shell scripts to web php is generally a bad idea. Saving data to a tmpfile is probably a way to leave it to and admin to recover later.
â danblack
20 hours ago
we are inserting the failed project_id's in separate table.We need to retry those Failed project_id's.How can I do this using shell script or with PHP. Please suggest me
â Ravin
20 hours ago
we are inserting the failed project_id's in separate table.We need to retry those Failed project_id's.How can I do this using shell script or with PHP. Please suggest me
â Ravin
20 hours ago
If it failed on the first attempt, why would it work when you retry? Please edit the question to show any error messages you're seeing.
â JigglyNaga
16 hours ago
If it failed on the first attempt, why would it work when you retry? Please edit the question to show any error messages you're seeing.
â JigglyNaga
16 hours ago
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
1
What failed ids? What SQL? What DB? How are they failing (exact error message)? Linking shell scripts to web php is generally a bad idea. Saving data to a tmpfile is probably a way to leave it to and admin to recover later.
â danblack
20 hours ago
we are inserting the failed project_id's in separate table.We need to retry those Failed project_id's.How can I do this using shell script or with PHP. Please suggest me
â Ravin
20 hours ago
If it failed on the first attempt, why would it work when you retry? Please edit the question to show any error messages you're seeing.
â JigglyNaga
16 hours ago