home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / xv221src / unsupt / getweath next >
Encoding:
Text File  |  1992-04-26  |  1.1 KB  |  49 lines

  1. #!/bin/csh -f
  2. #
  3. # getweather - gets the latest weather GIF image file from the anonymous ftp 
  4. # area of the server machine (SERVERHOST), in the directory (DIRNAME)
  5. # and copies it to the file WEATHERFILE if successful
  6. #
  7. # this should be run hourly, on the half-hour,  in a crontab entry
  8. #
  9. # John Bradley, 03/26/92
  10. #
  11. # based on getnettables, by John Dotts Hagan
  12.  
  13.  
  14. set SERVERHOST    = vmd.cso.uiuc.edu
  15. set DIRNAME     = wx
  16. set ACCT        = anonymous
  17. set PASS    = foo@bar.edu
  18. set HOSTMANAGER = root
  19. set WEATHERFILE = /usr/local/lib/weather.gif
  20.  
  21. set FNAME = SA`date -u +'%m%d%H'`.GIF
  22.  
  23. unset noclobber
  24. cd /tmp
  25. echo "open $SERVERHOST\
  26. user $ACCT $PASS\
  27. bin\
  28. hash\
  29. cd $DIRNAME \
  30. get $FNAME \
  31. quit" | ftp -n -i -v -d
  32.  
  33. if ( ! -e $FNAME) then
  34. #     echo "new weather file $FNAME was not created" \
  35. #        | /usr/ucb/mail -s "getweather error" "$HOSTMANAGER"
  36.      exit(-1)
  37. endif
  38.  
  39. if (-z $FNAME) then
  40. #    echo "new weather file $FNAME is empty" \
  41. #        | /usr/ucb/mail -s "getweather error" "$HOSTMANAGER"
  42.     exit(-1)
  43. endif
  44.  
  45. cp $FNAME $WEATHERFILE.1
  46. rm $FNAME
  47. mv $WEATHERFILE.1 $WEATHERFILE
  48.  
  49.