
#
# Random Dutch Word Daily Cron
# Version 0.8
#
#


EMAIL="user@host.blah"


LYNX="/usr/bin/lynx -nostatus -dump"
MAILX="/usr/local/bin/mailx"
TEMP="/tmp/random-dutch-word-TEMP.$$"
################################################################

# Get the random url page, store it in file

$LYNX 'http://host/path/to/ote/0.7/tools/random.php?dictionary=NL-EN.xml&direction=normal&match=exact&against=&skin=TXT&user=&reload_time=30' > $TEMP

# store the lynx output in BODY variable
BODY=`cat $TEMP`

# store current time in TIME variable
# The time now, in Year:Month:Day:Hour:Minute:Seconds
#$TIME=`date +Y%yM%mD%dH%HM%MS%S`

TIME=`date`

SUBJECT="OTE: NL to EN: Random Word: $TIME"

# clean up no longer needed file
rm $TEMP

# get the body into a file
`echo "$BODY" > $TEMP`

# tack on the disclaimer
#`cat /path/to/DISCLAIMER >> $TEMP`


# do the deed, mail it!
$MAILX -s "$SUBJECT" $EMAIL < $TEMP

# debug
echo $SUBJECT
cat $TEMP

# clean up again
rm $TEMP

