[CentOS] Shell Scripting Random Delay

Wed May 15 16:49:20 UTC 2013
SilverTip257 <silvertip257 at gmail.com>

On Wed, May 15, 2013 at 11:44 AM, Matt <matt.mailinglists at gmail.com> wrote:

> I have a shell script that's run every 5 minutes I use to call many
> other shell scripts.  Is there a way to wait a random number of
> seconds before executing each line?  Something like this.
>

Use your script to generate a random number [0] and pass that to the sleep
command?

[0] http://islandlinux.org/howto/generate-random-numbers-bash-scripting


> wait_random 10 - 180 (perl /scripts/my_script.pl) &
> wait_random 10 - 180 (perl /scripts/my_script5.pl) &
> wait_random 10 - 180 (perl /scripts/my_script7.pl) &
>
> I have many entries in this file and I background them all because
> most must poll network devices which can take time.  None should take
> over 2 minutes though.
>
> When I run them all at once they bog the system and cause some of
> latency graphs on equipment being monitored to look poor.
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>



-- 
---~~.~~---
Mike
//  SilverTip257  //