Jump to content


Photo

Cron RANDOM Variable


  • Please log in to reply
4 replies to this topic

#1 nfnovice

  • Senior Member
  • 696 posts

0
Neutral

Posted 11 February 2009 - 06:01

On one of the xml EPG grabber sites I use they have suggested that we randomise our cron times so as to spread load on their FTP server - OK I will try - but I cant find the equivalent random variable on my 7000

here is their suggested code to make the thing run any time between 1am and 6am

0 1 * * * sleep $((RANDOM % 18000)) && your command here

any thoughts on the equivalent or whether this is possible in a 7000 or 7020 ?
DM800+DM7025+DM7020+DM7000+DM600+DM5620+DM500+VUDUO Dreambox great invention - whats it for ?

Re: Cron RANDOM Variable #2 swq

  • Member
  • 4 posts

0
Neutral

Posted 16 March 2009 - 09:46

you can tryto insert RANDOM time in your script

ex:

crond:
0 1 * * * your command here(script)


script:

random time 
sleep random time 

....... 
your command 


now,when the crond start on 1am, it will exectue the script. it will sleep random time first !

Re: Cron RANDOM Variable #3 nfnovice

  • Senior Member
  • 696 posts

0
Neutral

Posted 16 March 2009 - 23:27

you can tryto insert RANDOM time in your script


yeah thanks mate - good suggestion but no kewpie doll
the problem is that random isnt included in the shell on either the cdk or the OE boxes
if it could work within a script as you suggest - it would work from from within crontab
what you get is

root@dm7020 ~ # random time
-sh: random: not found
root@dm7020 ~ #

cheers

Re: Cron RANDOM Variable #4 swq

  • Member
  • 4 posts

0
Neutral

Posted 18 March 2009 - 02:16

example:


#!/bin/bash
rnumber=$((RANDOM%30000+18000))
echo $rnumber
sleep $rnumber
.......
your command


it's script for radnom number between 18000-48000,you can modfily the red number for yourself.
hope it will helpful to you!

regards

Re: Cron RANDOM Variable #5 nfnovice

  • Senior Member
  • 696 posts

0
Neutral

Posted 18 March 2009 - 03:05

I understand how random works in a *nix environment
it just seems that access to random is not available in the DM - either from command line or script
- (although I see /dev/random and /dev/urandom do exist)
DM800+DM7025+DM7020+DM7000+DM600+DM5620+DM500+VUDUO Dreambox great invention - whats it for ?


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users