RE: randomize execution the a script?
> > I don't happen to have random installed on my system, however jot is > > It's in /usr/games/random of FreeBSD 4.8. > > > Won't randomNumber=$? Just return 0 if the previous command > completes > > successfully? > > Shouldn't it be: > > randomNumber=`random -e 60` > > No. In 'man 6 random', it says: > > random [-er] [-f filename] [denominator] > > -e If the -e option is specified, random does not > read or write any- > thing, and simply exits with a random exit value of 0 to > denominator - 1, inclusive. > > So you must capture its exit value for the random number :). Good enough! Thanks for the info! :) ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: randomize execution the a script?
Charles Howse wrote: > > I don't happen to have random installed on my system, however jot is It's in /usr/games/random of FreeBSD 4.8. > Won't randomNumber=$? Just return 0 if the previous command completes > successfully? > Shouldn't it be: > randomNumber=`random -e 60` No. In 'man 6 random', it says: random [-er] [-f filename] [denominator] -e If the -e option is specified, random does not read or write any- thing, and simply exits with a random exit value of 0 to denominator - 1, inclusive. So you must capture its exit value for the random number :). R. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
RE: randomize execution the a script?
> 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 > > done > > Where '60' means, maximum 60 seconds between two script calls. > > 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=$? Just return 0 if the previous command completes successfully? Shouldn't it be: randomNumber=`random -e 60` Or better yet randomNumber=`jot -r 1 1 60` ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: randomize execution the a script?
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 done Where '60' means, maximum 60 seconds between two script calls. There might be better or nices ways of doing this :). Rob. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"