Solved

want to use a script with netrc

Posted on 2007-11-25
4
1,098 Views
Last Modified: 2013-12-02
Hi I want to use a script with netrc . When ever i login using netrc i want to run some automatic script  ie change the directory ftp the file from remote system etc....
0
Comment
Question by:rpmindtools
  • 2
  • 2
4 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 20346505
Hi,

Very interesting links:

http://aplawrence.com/Unixart/scripting_ftp.html
http://pwet.fr/man/linux/formats/netrc

Both suggest the use of init macro to do what you want.

0
 

Author Comment

by:rpmindtools
ID: 20346508
Do you have an example.
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 500 total points
ID: 20346547
Hi,

The links provided have good examples. I will repeat them here:

in your ~/.netrc (in your home dir and have 600 as the file perms - chmod 600 ~/.netrc)

- example 1

machine somewhere.com login mylogin password mypass macdef
init
lcd /appl/fp/merge
cd /appx/data/50/XFR/Data
put artrx.tab TRXFER.dat
quit

Here when you

ftp somewhere.com

the login user name is mylogin
the password is mypass

and the init macro is executed after the successful login.
it change local and remote directories and put a file and quit

- example 2

machine someothermachine.org login whatever password pass macdef
init
hash
bin
prompt off

The 2nd example will run the commands hash , bin , and prompt off and then wait for your next command
0
 

Author Closing Comment

by:rpmindtools
ID: 31410874
Thanks
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
This article will show, step by step, how to integrate R code into a R Sweave document
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now