Hi. I want to create a script to read a file placed in a remote linux server using python..need help..?

Denis McMahon denismfmcmahon at gmail.com
Fri May 2 18:32:19 EDT 2014


On Fri, 02 May 2014 12:55:18 -0700, Bhawani Singh wrote:

> I have created the script till here ..
> 
> import os
> 
> os.chdir("/var/log")
> fd = open("t1.txt", "r")
> for line in fd:
>     if re.match("(.*)(file1)(.*)", line):
>         print line,
> 
> Output :
> 
> file1
> 
> --------------------
> this script i ran on the linux server, but now i want to run this script
> from another linux server and get the output displayed there..how can i
> do that...
> 
> i tried to use : pexpect but getting no help..

Method a:

Go and sit in front of the keyboard on the other linux server, run the 
script and read the screen.

Method b:

Use telnet to login to your account on the other server, run the script.

To run your script on someone elses machine usually needs you to be able 
to access their machine somehow. Either you are permitted to do it, in 
which case you should already know how to do it, or you're not permitted 
to do it, in which case we're not going to teach you how to do it here.

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list