#!/bin/sh FTP="ftp"; NTRY="10"; # number of times to try SLEEP="120"; # rest this many seconds between tries SIZE="2000"; # smallest allowed file size REMOTE_FTP_SITE="metalab.unc.edu"; REMOTE_FTP_SITE="www.ibiblio.org"; REMOTE_FILE="/pub/electronic-publications/Dr-Fun/latest.jpg"; LOCAL_FILE="/tmp/dr_fun_new.jpg"; URL="http://www.ibiblio.org/Dave/Dr-Fun/latest.jpg" VIEW="xv -geometry +1+1" VIEW="gw eog" if [ "$1" != "" ]; then SLEEP="$1" if [ "$2" != "" ]; then NTRY="$2" fi set -xv fi # function to try to get... go_get_it() { (cd /tmp; wcat -B $URL; mv latest.jpg $LOCAL_FILE) #if [ "`echo $FTP | grep ncftp`" != "" ]; then # $FTP -c $REMOTE_FTP_SITE:$REMOTE_FILE > $LOCAL_FILE #else # #$FTP $REMOTE_FTP_SITE << End_of_ftp #bin #get $REMOTE_FILE $LOCAL_FILE #quit #End_of_ftp # #fi } rm -f $LOCAL_FILE; # get rid of yesterday's count="0"; while [ "$count" -lt "$NTRY" ] do count=`expr $count + 1`; go_get_it; # try to get it # if it exists and is "big" enough: if [ -f "$LOCAL_FILE" ] && \ [ "`wc -c $LOCAL_FILE | awk '{print $1}'`" -gt "$SIZE" ]; then # what the heck, show him! if [ "$DISPLAY" = "" ]; then DISPLAY=:0.0; export DISPLAY; fi $HOME/script/slay -nr dr_fun; sleep 4; $VIEW $LOCAL_FILE & # 1>/dev/null 2>&1 & exit 0; else rm -f $LOCAL_FILE; # get ready to try again sleep 5 fi done exit 0