How I need to create retry shell script to retry the timedout ones? [on hold]

The name of the pictureThe name of the pictureThe name of the pictureClash 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










share|improve this question









New contributor




Ravin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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














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










share|improve this question









New contributor




Ravin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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












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










share|improve this question









New contributor




Ravin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|improve this question









New contributor




Ravin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Ravin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 38 mins ago





















New contributor




Ravin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









Ravin

11




11




New contributor




Ravin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Ravin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Ravin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




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












  • 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















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?