home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!spool.mu.edu!sdd.hp.com!ux1.cso.uiuc.edu!krisk
- From: krisk@ux1.cso.uiuc.edu (Kris Klindworth)
- Subject: Re: Automatic ftp session
- Message-ID: <C17vJ2.2A@ux1.cso.uiuc.edu>
- Organization: University of Illinois at Urbana
- References: <35150@adm.brl.mil>
- Date: Thu, 21 Jan 1993 18:32:48 GMT
- Lines: 46
-
- jbowyer@cis.vutbr.cs (Bowyer Jeff) writes:
-
- >I imagine the capability exists; therefore . . .
-
- >Would someone please send me a sample shell program that ftp's to a
- >site and returns a directory listing or gets a file . . . without user
- >intervention.
-
- >Thanks for your assistance.
-
- This is a variation on a script which we use fairly regularly
- for down loading files to a pc. In our case this script is
- run as an lpr filter and an old pc is serving as a print server.
- The conversion to a general utility is left to the reader
- as an exercise ;-).
-
-
- #! /usr/bin/sh
- machine="ux1.cso.uiuc.edu"
- user="anonymous"
- passwd="test"
- command="dir"
- timeout=5 # used with ping
-
- # check to make sure that the pc is running NCSA telnet
- # (Commented out because of possible incompatibilities with local ping)
- #/usr/etc/ping $machine $timeout
- #if [ $? != 0 ]
- #then
- # echo "$0: $machine is not avaible to handle your job" 2>&1;
- # echo "$0: cancelling job" 2>&1;
- # exit 1 ;
- #fi
-
- /usr/ucb/ftp -n <<EOT
- open $machine
- user $user $passwd
- $command
- quit
- EOT
-
- #------------------------------------------------------------------------------
- # Kris Klindworth Internet: krisk@ux1.cso.uiuc.edu
- # Database Programmer Phone : (217)244-7120
- # Illinois State Water Survey US Mail : 2204 Griffith Dr
- # Champaign, IL 61820
-