Hello hello, did a quick search and didn't turn up anything helpful. I've got a book I'm sure has the answers, but I don't think I'll have time to finish it before this all has to work, so here goes~ if this isn't a good place to post and someone could direct me to another forum I'd appreciate that just as much as an answer, wasn't really sure where to go...
There's quite a few things wrong here, and I've purposefully included a few that I had removed trying to test specific elements. Questions are:
1) How do I spawn rlogin with the tee command? When I try to execute it as such it doesn't work, if I remove the | tee ... portion it will, and adding spawn in twice didn't seem to work.
2) The prompt I'm working with on the IBM SAN controller is '->' - if I expect "->" it errors out, I tried \\-> and \\-\\> but didn't seem to have any luck, I imagine this one is just me being really stupid somewhere.
Edit: Fixed number 2 - I had backwards slashes. Number one still stands though :x
Anyway, I hope that the above is clear, I'd appreciate any criticisms or suggestions as I am very very new to expect. Thanks in advance.
Edit: In my actual script I have the password where <password> is here and that part works, in case there is any unclarity with regards to that bit.
--
~Vryali
Last edited by Vryali; 05-21-2009 at 02:09 PM..
Reason: Resolved the 2nd question, still not sure on the first.
Hi All,
i am trying to ssh to a remote machine and execute certain command to remote machine through script.
i am able to ssh but after its getting hung at the promt and after pressing ctrl +d i am gettin the out put as
expect: spawn id exp5 not open
while executing
"expect "$" {... (3 Replies)
Hi,
I am executing a expect script in while loop for doing telnet on list of servers stored in file as below :
expect script :
#!/usr/bin/expect -f
set timeout 20
set ip
set port
if { == 0} {
send_user "Usage: scriptname ip port\n"
exit 1
}
#exp_internal 1
log_user 0
spawn... (3 Replies)
Hi all,
I have a script that runs sftp with expect so I can login and send a file in a cronjob. I've installed this on a couple other servers and it has been fine. However, this time on this machine, it seems to be giving me an issue. It won't move past the spawn sftp command and return a... (3 Replies)
hi,
i have a problem with my expect script, here is MyScript:
#!/usr/bin/expect
set pass
set c
set command
spawn sudo $command
expect "assword"
send "$pass\r"
expect eof My problem is that when i execute MyScript with the command : "./MyScript mypassword apt-get_install_git"i get... (6 Replies)
Can 'spawn' script be used more than once in a given expect script ??
What I'm trying to do is, first log-into a remote server through one 'ssh' spawn com and then from there log-into another server using a secod 'ssh' spawn command. But this approach is not working... the second ssh attempt... (1 Reply)
Hi everybody,
We are trying to connect to a server and to a router using an .expect script that automatically authenticate the username and password needed. The error is that we cannot connect to the server using ssh AND we cannot connect to the router using either telnet or go commands from the... (1 Reply)
This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
Hi All,
I have to write one expect script to login to one system.
I am using
set timeout -1
match_max 100000
spawn ssh root@hostname
Now when I do spawn ssh to that host it send some warning message and one challenge
Challenge: 111-2345
I need to read this challenge value and has... (1 Reply)