Date: Thu, 18 Sep 2003 05:49:47 -0500 From: "Charles Howse" <chowse@charter.net> To: "'Rob Lahaye'" <lahaye@snu.ac.kr>, "'Gil Agno Virtucio'" <gihl@nesic.com.ph>, <freebsd-questions@FreeBSD.ORG> Subject: RE: randomize execution the a script? Message-ID: <001701c37dd2$9467f170$04fea8c0@moe> In-Reply-To: <3F697722.3000302@snu.ac.kr>
next in thread | previous in thread | raw e-mail | index | archive | help
> Gil Agno Virtucio wrote: > > Hi. I want to randomize the execution of a shell script.=20 > Can i use cron=20 > > to do this? or are there other available tools that i can=20 > use to do this? >=20 > See 'man 6 random' and 'man sleep'. > Then try doing something like this in the background: >=20 > #!/bin/sh > while true > do > random -e 60 > randomNumber=3D$? > sleep $randomNumber > <do shell script here> > done >=20 > Where '60' means, maximum 60 seconds between two script calls. >=20 > There might be better or nices ways of doing this :). I don't happen to have random installed on my system, however jot is installed with the base system, and will generate random numbers quite well. For example 'jot -r 1 1 60' will generate a single random number between 1 and 60. Won't randomNumber=3D$? Just return 0 if the previous command completes successfully? Shouldn't it be: randomNumber=3D`random -e 60` Or better yet randomNumber=3D`jot -r 1 1 60`
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001701c37dd2$9467f170$04fea8c0>