Re: [newbie] telnetscript

2001-06-16 Thread Tim Holmes

Well depending on how many commands you want to run, you can just use
ssh.  For example.

[timh@yoda timh]$ ssh chewbacca cat .aliases | grep root | wc -l
timh@chewbacca's password:
   3

So I ssh'd to CHEWBACCA, cat'd the .aliases file I have in my root
directory.  grep'd out the word root, then piped it through wc. (Word
Count.  The -l counts how many lines have the word root in them)  It
then returns the information just as if I were on that machine.

Now if you need to run a couple of commands you can do several things.
Write a script on the remote machine to do the work you need.  Then ssh
to the machine and run that script.

--  OR  --

You could write an expect script.  To then log onto the machine, then
run a command, then run another command after that, then
so-on-and-so-forth.  I like using expect personally.  The expect RPM is
on one of the Mandrake CDs.

#!/usr/bin/expect
spawn telnet -l $USER $HOST
expect assword:
send $PASSWORD\r
expect $
send FIRST COMMAND
expect $
...
...
...
interact

If you close the script with interact you will now be on that remote
machine via your telnet connection and can continue to do other if
you'd like.

But those are my suggestions.
tdh


T. Holmes
-
UNIXTECHS.org
[EMAIL PROTECTED]
-
Real Men Us Vi!

| Hello!
| 
| I want to write a script that makes telnet to log in and send some commands
| 
| How do I do?
| 
| 
| //Magnus
| 
  -- 




[newbie] telnetscript

2001-06-15 Thread Magnus Stenemo

Hello!

I want to write a script that makes telnet to log in and send some commands

How do I do?


//Magnus




Re: [newbie] telnetscript

2001-06-15 Thread Paul

 Hello!
 
 I want to write a script that makes telnet to log in and send some commands
 
 How do I do?

Hi Magnus,

I think redirecting would work:

your script could be

open your-host-name-here
command1
command2
command3
exit

and then you simply do

telnet  scriptname

I can't check the validity here, but I do the same with FTP.
Paul





Re: [newbie] telnetscript

2001-06-15 Thread Ric Tibbetts

Paul wrote:

Hello!

I want to write a script that makes telnet to log in and send some commands

How do I do?

 
 Hi Magnus,
 
 I think redirecting would work:
 
 your script could be
 
 open your-host-name-here
 command1
 command2
 command3
 exit
 
 and then you simply do
 
 telnet  scriptname
 
 I can't check the validity here, but I do the same with FTP.
 Paul
 
 
 

Why not just use rsh? This is what it's made to do.


Ric