How do I write a script to terminate in 10 hours if a file is not found.
The script has to check for a file, if file not found go to sleep for 1 hour, check again....sleep....
If file not found even after 12 hours, then exit with error
x=0
while (( $x < 12 ));
do
if [[ ! -f yourfile ]];
then
echo "your file not found"
sleep 3600
else
echo "your file found"
#if you don't want to exit, then comment "exit" and then add command 'sleep 3600' also.
exit
fi
((x=x+1))
done
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.