home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / question / 15807 < prev    next >
Encoding:
Text File  |  1993-01-21  |  1.7 KB  |  57 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!spool.mu.edu!sdd.hp.com!ux1.cso.uiuc.edu!krisk
  3. From: krisk@ux1.cso.uiuc.edu (Kris Klindworth)
  4. Subject: Re: Automatic ftp session
  5. Message-ID: <C17vJ2.2A@ux1.cso.uiuc.edu>
  6. Organization: University of Illinois at Urbana
  7. References: <35150@adm.brl.mil>
  8. Date: Thu, 21 Jan 1993 18:32:48 GMT
  9. Lines: 46
  10.  
  11. jbowyer@cis.vutbr.cs (Bowyer Jeff) writes:
  12.  
  13. >I imagine the capability exists; therefore . . .
  14.  
  15. >Would someone please send me a sample shell program that ftp's to a
  16. >site and returns a directory listing or gets a file . . . without user
  17. >intervention.
  18.  
  19. >Thanks for your assistance.
  20.  
  21. This is a variation on a script which we use fairly regularly
  22. for down loading files to a pc. In our case this script is
  23. run as an lpr filter and an old pc is serving as a print server.
  24. The conversion to a general utility is left to the reader
  25. as an exercise ;-).
  26.  
  27.  
  28. #! /usr/bin/sh
  29. machine="ux1.cso.uiuc.edu"
  30. user="anonymous"
  31. passwd="test"
  32. command="dir"
  33. timeout=5  # used with ping
  34.  
  35. # check to make sure that the pc is running NCSA telnet
  36. #    (Commented out because of possible incompatibilities with local ping)
  37. #/usr/etc/ping $machine $timeout
  38. #if [ $? != 0 ]
  39. #then
  40. #    echo "$0: $machine is not avaible to handle your job" 2>&1;
  41. #    echo "$0: cancelling job" 2>&1;
  42. #    exit 1 ;
  43. #fi
  44.  
  45. /usr/ucb/ftp -n <<EOT
  46. open $machine
  47. user $user $passwd
  48. $command
  49. quit
  50. EOT
  51.  
  52. #------------------------------------------------------------------------------
  53. # Kris Klindworth                    Internet: krisk@ux1.cso.uiuc.edu
  54. # Database Programmer                Phone   : (217)244-7120
  55. # Illinois State Water Survey        US Mail : 2204 Griffith Dr
  56. #                                             Champaign, IL 61820
  57.