How to make bash script run with a latency (i.e. wait 1 sec at each iterations)?
Posted
by
user2413
on Ask Ubuntu
See other posts from Ask Ubuntu
or by user2413
Published on 2011-02-17T14:39:37Z
Indexed on
2011/02/17
15:33 UTC
Read the original article
Hit count: 271
I have this bash script;
for (( i = 1 ; i <= 160 ; i++ )); do
qsub myccomputations"${i}".pbs
done
Basically, I would prefer if there was a 1 second delay between each iteration. The reason is that at each iterations, it sends the program file mycomputation"${i}$.pbs
to a core node for solving.
Solving in this instance involves the use of pseudo random numbers. I suspect the RNG I use (R's) uses CPU time as seed because as things are now I get repeating pseudo random numbers (at the rate of approx 1 out of 100).
So how to you ask bash to
for (( i = 1 ; i <= 160 ; i++ )); do
wait 1 sec
qsub myccomputations"${i}".pbs
done
© Ask Ubuntu or respective owner