Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re .netrc file

Status
Not open for further replies.

KOG

MIS
Jan 31, 2002
303
GB
Hi folks

I need to create another .netrc to transfer a different file from F50 to backup file server. I have a script that runs every night to copy the file every morning to sql server and now I need another .netrc script to run, is it possible to create .netrc2 file or add another script to the end of the current .netrc file?

Has anyone of you done this task? If so pls share the experience with me.

Many thanks

K
 
Are both of these backups to the same machine?

If they're to different machines you can add another machine section to your .netrc file to handle it. It sounds like your original .netrc must contain an "init" macro definition, in order to automatically move the file. Insert a blank line after the last ftp command in the init macro, then below it create the necessary machine, login, password, etc.. entries for your second machine.

If you're backing up both files to the same server and need to do it at different times or logged in as different users, you'll need to store your two netrc files in their own files (netrc.1 & netrc.2, for example) and create a shell script or scripts to cp the appropriate netrc into .netrc. Be sure after copying to "chmod 600 .netrc" if permissions aren't already set that way before ftping.

HTH,

Rod

Rod Knowlton
IBM Certified Specialist - AIX V4.3 & 5L System Administration

 
Hello Rod

Many thanks for your reply, I have amended the .netrc to include the second sectionm for a different machine. The only problem I have at the mo is how do I CD the current /home directory (where .netrc file is located as the oracle scheduled script starts reading from this directory) to the backup directory. For some reason, I seem to be having difficulties.

machine IP address
macdef init
[would like cd /backup here - but wont work?]
bin
cd \bsndata
put bsndata.LST
bye

Any ideas or suggestions? Thanking you all in advance.

Regards

K
 
Why not just have the full path in your put line:

put /backup/bsndata.LST
 
If you want to change directory on the machine with the .netrc file you need to use lcd in the .netrc script.

Alan
 
Hi

I am trying to use the .netrc file to ftp the backups to windows 2000 fileserver, I have done the following tasks

1) Created .netrc file

machine <IP Address>
macdef init
lcd /backup
bin
cd \test
put testfile
bye

2) Updated .rhosts on oracle home directory where .netrc file is located with the IP address of the Win 2000 fileserver.

3) Updated /etc/hosts with the IP address of Win 2000 fileserver.

4) Changed .netrc file permission (chmod 600)

And it failed to run, I get this error message and I am not clear why and how this error message came up/reason for it?

$ ftp 130.7.101.252
ftp: connect: Connection refused
ftp>

Any idea why? Thanking you all in advance.

Regards

Katherine
 
This is the &quot;new&quot; machine you are backing up to, right? Check that ftp server services are running on the Win 2000 server.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top