#!/bin/sh # # this script should be run Sunday at midnight from cron by # the user who runs freeguide # # works on Linux. does not work on NetBSD because of differences # in the date command # # prune older listings find $HOME/.freeguide-tv/ -name "*.xmltv" -atime +2 | xargs -t -l rm # download one week of listings OFFSET=0 for each in sunday monday tuesday wednesday thursday friday saturday; do FILE="$HOME/.freeguide-tv/tv-`date -d $each +%Y%m%d`.xmltv" [ -f "$FILE" ] || tv_grab_na_dd --config-file "/home/inittab/.xmltv/tv_grab_na_dd.conf" --offset $OFFSET --days 1 --quiet --output $FILE OFFSET=`echo ${OFFSET}+1 | bc` done