In my script i need to sleep for some seconds till the previous command exeuction is successful
i need to sleep for 5 seconds if the copy command fails and check till 10 times after 10th time the script will exit saying file not copied after attemping 10 times
What makes you think the system will continuously attempt to try to copy?
Your logic wont work like that, you need a loop for the copy that does 10 attempts or gets out of the loop if one is successful with the sleep in the loop
Yes i agree with you i need to do loop 10 times if it exeeds 10 times and still not able to copy due to some other issues like folder not exists, then exit with sleep. like how you suggested.
So would like to know how i can be able to do that
Yes i agree with you i need to do loop 10 times if it exeeds 10 times and still not able to copy due to some other issues like folder not exists, then exit with sleep. like how you suggested.
So would like to know how i can be able to do that
I am confused here. What is the need to exit and wait a few seconds for it to happen using sleep 5 . I really do not understand your logic.
vbe has already commented what you need so why not try a simple loop to see what happens.
I think this is what you might be after! NOTE! There is no capture of any errors/reports that get printed to 'stderr' or 'stdout'.
Try something basic and see if you understand the logic:-
The first 'echo' is purely for checking and remove if you are happy and why did I comment out # RC=1 ?
I have used a 1 second sleep here purely for checking...
You are here to learn so try and tell us what you think is happening?
This User Gave Thanks to wisecracker For This Post:
Sorry for confusing you guys. I didnt reperesnt in correct way. Thanks guys
Exactly this is what i wanted i am trying to [perfom copy operation.After trying to make one attempt it will sleep for sometime. Like this it will try to attempt for 10 times. Post then if still not able to copy it will exit the script stating tried 10 attempts.
One more thing is there a way to break the loop if copy is successful
But after doing break its printing Copy Failed
i got it to do like this thanks guys
Last edited by Master_Mind; 03-16-2017 at 07:41 AM..
Reason: to update the script
I am an experienced MS Windows user who has tried four different flavors of Linux: Mandriva, Centos, Debian, and Ubantu---each on a different PC. (I always used a dual-boot configuration with Grub and Win XP or Win 7). Each time, I encountered the following two problems:
While resuming from... (2 Replies)
Hello,
I am trying to write a unix cmd , that if files in folder /path/FTP are all zero kb or empty then good to go, if not empty then sleep for 8 hrs.
Following cmd list me the files which are not empty, But when I am incorporating IF ELSE cmd fails
find /path/FTP. -type f -exec wc -l {}... (6 Replies)
Hi ,
How can I use floating point argument for sleep command in unix.I cannot use usleep as it is not suppported.
Also how can I find out that a file is in use at that particular instant only.(wether it is being read or written) (7 Replies)
This is a very crude attempt in Bash at something that I needed but didn't seem to find in the 'sleep' command. However, I would like to be able to do it without the need for the temp file. Please go easy on me if this is already possible in some other way:
How many times have you used the... (5 Replies)
how can I find cpu usage memory usage swap usage and
I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times
my final destination is monitor process
logical volume usage above X % and number of Logical voluage above
can I not to... (3 Replies)
please help me to fix my script trying to use sleep 2 minutes while the system is sleeping i want to print out same message every 5 seconds
thanks
t=`date +%S`
while
do
sleep 5
echo "this program will end in 2 minute"
done (1 Reply)
Hi
I have a lot of scripts running on a Sun Solaris server, which are constantly running in a loop looking for work to do. When they have no work they sleep for a certain amount of time (60secs normally). I have 13 of these scripts running the number of sleep command issued can be in the order... (4 Replies)