[mythtv-users] Zap2It needs our help

David Rees drees at greenhydrant.com
Sun Jun 13 22:15:20 EDT 2004


DacidBadada at netscape.net wrote, On 6/13/2004 6:28 PM:
> Hi everyone - 
> Just wanted to draw everyone's attention to this:
> http://bb.labs.zap2it.com/viewtopic.php?t=139
> 
> Basically, we're killing zap2it's servers b/c everyone is downloading in the wee hours of the morning. 
> (3:00 a.m. CDT and 8:00 a.m)
> 
> Pick a random minute (say now) and use the date of the month 
> of your birthday (mod 24 if you want to be picky) for the hour.  
> (Credit for this idea goes to Robert on the zap2it labs forum).
> 
> Please update any documentation as well.
> 
> I figure if we're nice to them, maybe they'll stay nice to us (not charge for the service, etc)

I posted at the zap2it forum with a script to weekly schedule 
mythfilldatabase runs at a random time.

The scheduling script:
-----
#!/bin/sh
HOUR="$(expr $RANDOM \% 24)"
MIN="$(expr $RANDOM \% 60)"
DAYS="0 1 2 3 4 5 6"
COMMAND="mythfilldatabase"
if [ $MIN -lt 10 ]; then
         MIN="0$MIN"
fi
for day in $DAYS ; do
         DATE="$HOUR:$MIN + $day days"
         echo $COMMAND | at $DATE
done
-----

Save the script in your home directory.  Then add an entry to your 
crontab to run once a week to schedule the next week's updates:

0 0 * * 0 $HOME/schedule-mythfilldatabase.sh

Run the script once manually to schedule runs for the next 7 days. 
You'll want to either remove any runs that get scheduled on or past the 
next Sunday, or update the cron job to run the same day of the week that 
you manually ran the schedule.  For example, if you first run the 
schedule script on Wednesday, you can change your crontab entry to run 
every Wednesday at midnight like this:

0 0 * * 3 $HOME/schedule-mythfilldatabase.sh

Hope this helps.  Feel free to use this script and documentation 
anywhere appropriate.

-Dave


More information about the mythtv-users mailing list