From: fedorafans on 9 Feb 2010 15:51 I am writing an expect script which sshs into some special network devices and grab a stats file. When i manually run it there is not problem at all, but when I put the same expect script into cron, i get randomly "EOF" being sent from the device as soon as the passwd gets sent to the device. Can anyone take a look at my script and tell me what is wrong and why the device sends EOF to my script?(i tried to set the term type and did not work), much appreciate! The core part of the expect script looks like this, while {[gets $list line] != -1} { spawn ssh -t admin@$line expect { "password:" { send "$password\n" expect "admin" send "shell\n" expect { "ksh" { send "cat /tmp/status.txt\n" expect "commands" send "exit\n" expect "admin" send "exit\n" } eof {wait} } } timeout {break} } } and the error message is like this: send: sending "shell\n" to { exp8 } expect: does "@06:/# " (spawn_id exp13) match glob pattern "ksh"? no shell expect: does "@06:/# shell\r\n" (spawn_id exp13) match glob pattern "ksh"? no Connection to a.b.c.d closed. expect: does "@a.b.c.d:/# shell\r\nConnection to a.b.c.d closed.\r\r \n" (spawn_id exp13) match glob pattern "ksh"? no expect: read eof expect: set expect_out(spawn_id) "exp13
From: dave.joubert on 10 Feb 2010 04:29 On Feb 9, 8:51 pm, fedorafans <fedoraf...(a)gmail.com> wrote: > > When i manually run it there is not problem at all, but when I put the > same expect script into cron, i get randomly "EOF" being sent from the cron can be 'funny'. Often a whole class of problems can be solved by just creating a small shell script, that calls the real script, and asking cron to call the new script instead. Dave
From: fedorafans on 10 Feb 2010 09:47 I tried that method, and it did not work, :( Any other suggestions? Thanks a lot! On Feb 10, 3:29 am, "dave.joub...(a)googlemail.com" <dave.joub...(a)googlemail.com> wrote: > On Feb 9, 8:51 pm, fedorafans <fedoraf...(a)gmail.com> wrote: > > > > > When i manually run it there is not problem at all, but when I put the > > same expect script into cron, i get randomly "EOF" being sent from the > > cron can be 'funny'. Often a whole class of problems can be solved by > just creating a small shell script, that calls the real script, and > asking cron to call the new script instead. > > Dave
From: dave.joubert on 11 Feb 2010 03:43 On Feb 10, 2:47 pm, fedorafans <fedoraf...(a)gmail.com> wrote: > I tried that method, and it did not work, :( > > Any other suggestions? Thanks a lot! No other suggestions. But, it is almost certainly an infrastructure problem rather than a an expect problem. I do not see any way of solving this without access to test system. Do you have any way of packaging the problem into something that can be run on another set of machines ? Dave
From: fedorafans on 11 Feb 2010 10:12 Thanks for your reply, I ran the script on another machine with same result. I know this is caused by the target system, and I was hoping there were some workarounds. :( > No other suggestions. But, it is almost certainly an infrastructure > problem rather than a an expect problem. I do not see any way of > solving this without access to test system. Do you have any way of > packaging the problem into something that can be run on another set of > machines ? > > Dave
|
Next
|
Last
Pages: 1 2 Prev: question on kbskit/starkit Next: Block all keyboard input for a toplevel. |