Re: Shell Script Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 09/05/2013 11:24 AM, Matt wrote:
> I have a script file in my cron.hourly that contains a good number of
> scripts I must call.
> 
> #!/bin/sh
> 
> sleep 15
> perl /scripts/create_graph.pl &
> 
> sleep 15
> perl /scripts/create_graph_out.pl &
> 
> many more lines. etc.
> 
> Is there a way I can sleep random length to time before executing each
> but background each one so master script returns promptly.  Something
> like.
> 
> sleep (random 1 - 300 seconds, perl /scripts/create_graph_out.pl) &
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> http://lists.centos.org/mailman/listinfo/centos
> 

If you are trying to avoid running all these perl scripts concurrently
set up the perl scripts to accept an argument, then pass each one a time
delay when you call them.

PerlScript-1 20 &
PerlScript-2 40 &
...
PerlScript-n n*20 &

The calling script will return almost immediately but the perl scripts
will delay any action for the specified time.  That way the time delay
is fully adjustable from zero to forever.

-- 
    _
   °v°
  /(_)\
   ^ ^  Mark LaPierre
Registered Linux user No #267004
https://linuxcounter.net/
****
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos





[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux