write auto-ftp script..help please

write auto-ftp script..help please

Post by Jonathan Hurwi » Fri, 27 Jan 1995 04:15:06



Hi,

I have two networked machines running unix (one SunOS, one Irix), that I'd
like to write a script that, daily, will automatically (from one to the
other), ftp in, change to a certain directory, get a text file and save it
in a certain directory and log out.

The file is a log file, and the date will change everyday, so the script
needs to be smart enough to look for yesterday's date.

is this at all possible?? i have no exp. doing these things, so if it is
possible, how could i do it, what to do it in, etc.

any and all help appreciated

tia,
jonathan

 
 
 

write auto-ftp script..help please

Post by Storm Softwa » Sat, 28 Jan 1995 01:14:17


: I have two networked machines running unix (one SunOS, one Irix), that I'd
: like to write a script that, daily, will automatically (from one to the
: other), ftp in, change to a certain directory, get a text file and save it
: in a certain directory and log out.

ftp will take input from a file so try the syntax

        ftp < script_file.

Your script file will then hold data such as

        open ftp.edu.us
        anonymous

        cd /fred
        get file
        bye

The script_file itself could be daily created by another script which
is running on cron, thereby getting round you daily date problem.

Good luck      
--


 
 
 

write auto-ftp script..help please

Post by Anil V. Narwa » Wed, 01 Feb 1995 03:07:15


: Hi,

: I have two networked machines running unix (one SunOS, one Irix), that I'd
: like to write a script that, daily, will automatically (from one to the
: other), ftp in, change to a certain directory, get a text file and save it
: in a certain directory and log out.

Try this -- create a file called .netrc in your home directory with
contents something like this:

          machine xyz login userabc password userpass macdef init
          cd ...
          get ...
           ...
           ...
          bye

Then when you type 'ftp xyz', it will automatically log in to the
system 'xyz', as user 'userabc' with password 'userpass' and
execute the commands below it.  Oh, you must leave a blank line
after the 'bye' so it knows that it's done.  You can 'man ftp' or
'man netrc' for more details.

: The file is a log file, and the date will change everyday, so the script
: needs to be smart enough to look for yesterday's date.

You need to use cron on you local machine to get run a script.  The
script should get the current date, subtract 1 from it (I believe
that the 'date' command has the capability to do this), append it
to whatever else to generate the name of the file to be transferred,
and have the script write the .netrc file at that time with the
required filename, etc.  Then it should do the ftp command.

: is this at all possible?? i have no exp. doing these things, so if it is
: possible, how could i do it, what to do it in, etc.

It is possible -- I'm using something like this to do backups
for a system with a dead tape drive where the tape drive costs
more than the system is currently worth.

: any and all help appreciated

: tia,
: jonathan

-Neil.

--
----------------------------------------------------------------------.

|           http://cessna.med.miami.edu/~cobra/Anil.html               |
`----------------------------------------------------------------------'

 
 
 

1. nis, nfs, autofs: auto.master, auto.misc, auto.home help please

I have nfs, nis working correctly.  I know this because I can mount my
server /home directory from the client, and also from the client, I can
access the passwd and group files from my nis server.  All this is fairly
easy to set up.  The problem I cannot resolve at this time is being able
to login to my server's home directories from the client machine.  It
logs into the / directory instead.  Here is what I know:

There are various packages like autofs and amd to take care of what I
want to do.  I am trying to do this with autofs.  My setup (yes I posted
several days ago, but the NIS HOWTO doesn't help me with this) is a
Debian server, with a Redhat 7.2 and Solaris 8 client.  I have read many
posts about these files:

/etc/auto.master
/etc/auto.misc
/etc/auto.home

and various other files.  I also have read the AutoFS HOWTO at:
http://www.linux-consulting.com/AutoFS/autofs-HOWTO.html

While it contains examples for autofs, I do not understand them fully,
otherwise, I would not be writing this now.  My questions are:

If /etc/auto.master contains (according to the auto.master manpage:

/home     /etc/auto.home

does the auto.master file reside on the client, server or both?  Also, is
the /home in this referring to the server's /home which I want to mount
on the clients /mnt/home?

I also am not sure what /etc/auto.misc is for, and where it lives, along
with /etc/auto.home.  My server's home directories are on my /home
partition and I can see them from my client machines on /mnt/home.
However, I can not figure out how to use autofs to take care of mounting
them when a user logs in.  The user must cd /mnt/home, and this is what I
want to automate.  I am sorry if my questions annoy anyone.  I want to
learn, and once I learn, I can also help other people.  Thank you.

Bob Gamble

2. Apache/Tomcat 4 and Virtual Hosts?

3. how to detect error and quit in auto-ftp script?

4. Quiet CD-Rom Drive

5. Auto dial-ISP and auto-FTP download

6. use 486 as x terminal or server or use pent pro...

7. Need help on FTP script writing

8. awk expert needed!

9. Help in writing script for extracting tar files, please!

10. Help needed on writing scripts to transfer files by FTP

11. Can someone please help with a script I'm writing...

12. How to write auto login script for minicom?

13. A script to perform a ftp session - Please HELP