Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 2003 18:13:06 +0900
From:      Rob Lahaye <lahaye@snu.ac.kr>
To:        Gil Agno Virtucio <gihl@nesic.com.ph>, freebsd-questions@FreeBSD.ORG
Subject:   Re: randomize execution the a script?
Message-ID:  <3F697722.3000302@snu.ac.kr>
In-Reply-To: <web-3479645@digitelone.com>
References:  <web-3479645@digitelone.com>

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. Can i use cron 
> to do this? or are there other available tools that i can use to do this?

See 'man 6 random' and 'man sleep'.
Then try doing something like this in the background:

#!/bin/sh
while true
do
   random -e 60
   randomNumber=$?
   sleep $randomNumber
   <do shell script here>
done

Where '60' means, maximum 60 seconds between two script calls.

There might be better or nices ways of doing this :).

Rob.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F697722.3000302>