Ubuntu :: Good Expect Tutorial For Programing With Expect?

Nov 2, 2010

I'm trying to Use Expect to automate a curl function. basically I don't want to type enter for my script to run. Can anyone point me to a good Expect tutorial?

View 1 Replies


ADVERTISEMENT

Programming :: /usr/bin/expect : Script To Check Server Load Using Both Expect And Bash?

Jul 27, 2010

I am trying to make a script that can be used to check server load on a remote server and produces sound on our local machine, when server load exceeds a particular limit.1. I want to execute command uptime or uptime | awk '{print$10}'on the remote server and store the result in a variable(say x), and later use it in the bash script.

Bash Part
#!/bin/bash
x=$(/root/Desktop/exp)

[code]...

View 1 Replies View Related

Ubuntu :: Shell Script For Telnet Using Expect - Unable To Find The Tutorial

Jan 22, 2010

I need to open a telnet session using a shell script that follows this format:

telnet 10.100.0.1
expect "Password:"
send <password>

[code]....

send "pen" (till the end of lines generated as in |more.... usually we use like 8 space bar buttons after "pen" to generate all)
and I want to redirect the whole generated result of "pen" to results.

View 3 Replies View Related

General :: Expect: Line Seems To Match Exactly However Expect Thinks Not?

Jun 16, 2010

I am writing an expect script. At a certain point there is a rule that produces this debugging output:

Code:

expect: does " Address or name of remote host [x.x.x.x]? " (spawn_id exp8) match glob pattern " Address or name of remote host [x.x.x.x]? "? no This just times out When I use -exact for the expect keyword it does work What am I doing wrong? THe first should also match in my opinion because it is equal as well. Even if I remove the I still have the same issue if I try without -exact. I don't understand. I tried removing the but still got the same.

View 5 Replies View Related

Programming :: Expect Script: Send Function Key F12 In An Expect Script?

Nov 19, 2008

I'am new to expect how do i send function key F12 in an expect script?

View 1 Replies View Related

OpenSUSE :: Good Documentation About Expect - Build Complex Script - Work To Automatically Connect To 50 Pc`s

Aug 20, 2010

I was wondering if you could help me find a good documentation about expect, I have searched all the web but with no luck. I need to build a complex script that I need at work to automatically connect to 50 pc`s (with linux based os) and execute 10 or more script with the output into a text file and the email the file to my email address.

View 3 Replies View Related

Ubuntu :: Using 'expect' And Scp - Hiding Prompts?

Mar 25, 2010

I'm using a small "expect" script to automate password entry for some file copying.The automation works fine, but the "Password: " prompt still displays on the screen. How do I hide the prompts so the user doesn't see "Password: " on the console?Here's the relevant section of my script:

Code:
expect -c "spawn /usr/bin/scp -q $2 user@$1:$2
set timeout 60

[code]....

View 9 Replies View Related

General :: Not Able To Come Out Of Expect / Sort It?

Jun 28, 2011

I am using expect command to pass password to my script.

like code...

it will send password properly, but after that it will not come out of expect to bash.

View 4 Replies View Related

Programming :: Send '/' In Expect?

Aug 9, 2010

I'm trying to use expect to telnet to web server and send HTTP command like POST, GET, etc.

Here's my code...

But this gives an error

couldn't read file "/cgi-bin/authgw-cgi": no such file or directory

I think this is because of /

How to send / in expect?

View 3 Replies View Related

Programming :: Control VI With Tcl And Expect?

Mar 7, 2011

I'm using expect to log into a remote server and run a script. I want to able to have expect edit the output from that script, on the remote server, in VI. Has anyone ever done this before, it seems as though the expect interpreter has nothing to expect once VI is started, the file pointer starts at the beginning of the line, and expect usually reads the characters before the pointer.

spawn ssh user1@$remote_server
expect "password: "
send "$password

[code]....

View 2 Replies View Related

Ubuntu :: Expect Script To Establish SSH Connection

Nov 12, 2010

I've got an Expect script that establishes a ssh connection to the iLO interface of a server. Problem is it drops me back to the local terminal and I can't enter commands to be executed on the remote host. How do I get it so it logs me into the server then leaves me connected to it?

Code:
expect -f - <<-expect_script_end
spawn ssh -o StrictHostKeyChecking=no $user@$host
match_max 100000
expect "*?assword:*"
send -- "$pass
"
send -- "
"
expect eof
expect_script_end

The ssh server running on the iLO interface appears to be sending eof's which is causing expect to exit. How can I get it to ignore them?

View 3 Replies View Related

Ubuntu :: Bash Script With Expect - Headers ?

Jul 6, 2011

I have a script which uses a function and also uses expect.

If I have #!/bin/bash as the first line, the function is recognised. The expect calls are not, failing first with spawn.

If I have #!/bin/expect as the first line, the expect and spawn work fine. The function is not recognised.

My friend Google brings up examples with both these lines one after another in script files, just like Im doing. Except for me it doesnt appear to work.

Where am I making my beginners mistake in not understanding how this works ?

View 2 Replies View Related

Software :: Return Value Of Expect Script?

Jul 9, 2009

I am trying to return a variable's value from an expect script to the command line or a calling script..$res has a value of 1.

I do a ..
expect "*"
sleep 1

[code]...

View 11 Replies View Related

Programming :: Use Expect To Get Data From Telnet?

May 21, 2011

I'm trying to use expect to get data from telnet

Here's my code :

Code:
set equipment [lindex $argv 0]
set trunk [lindex $argv 1]
set fraction [lindex $argv 2]

[Code]....

so in bold letter not send in 1 line, but i want sent it to 1 line

View 2 Replies View Related

Programming :: HTML To PHP To EXPECT Formatting?

Apr 13, 2011

I wrote an expect script that tests user authentication against a RADIUS server. The username is an email address, including an @ sign. I recently wrote an HTML/PHP front end to allow others to input username/password into a form and then see the results when they hit submit. Expect code that takes two args username, and password

Code:

expect "#"
send "test aaa group radius [lindex $argv 0] [lindex $argv 1] new-code
"expect "#"

[code]....

Every works as it's supposed to, except for the output of the script. When it displays on the webpage, it's segmented weirdly with  all throughout. What I've found is when I remove the @ sign in the username input, it fixes it. Is there any part of HTML or PHP that treats the @ as a special character? 1 more thing is that I have another HTML/PHP/EXP script that works fine with the @.

View 2 Replies View Related

Programming :: Resources For 'expect' Practice?

Jul 12, 2010

I am starting a new job, and need to brush up on my expect scripting. does anyone know of any online resources, e.g. telnet sites that I can play about with?

View 4 Replies View Related

Ubuntu :: Can't Spawn Telnet Session In Expect Script

Apr 22, 2010

I am moving my migration forward and am trying to get my expect scripts tested and found one that no longer works. Quite simply, it spawns a telnet session to a router.

#!/usr/bin/expect
set env(TERM) vt100
set timeout 3
set send_human {.1 .3 1 .05 2}
set timeout -1
#
spawn telnet 10.254.3.232

and that's it. The result of the script is that the command to spawn simply shows up on the screen like it is a puts command. On my older openSUSE system, it worked fine. I am running Ubuntu v9.10 desktop, and expect and its libs are patched to the latest rev, expect is 5.43.0.

View 1 Replies View Related

Ubuntu Installation :: Where To Find Expect That Will Work On10.10

Mar 25, 2011

I'm new to Ubuntu and am looking for the Tcl/Tk extension Expect. I have several Expect scripts that I would like to use but I don't know where I can find a version of Expect that will work with Ubuntu 10.10.Does anyone know where I can download this?

View 1 Replies View Related

Programming :: 'read' Functionality In Expect Script?

Aug 2, 2010

Is there a similar thing in expect, as there is 'read'(Read a line from standard input) in bash?I mean one could easily construct following script in bash:

Code: > cat script.sh
#!/bin/bash
read -p "Username: " uname

[code]....

View 1 Replies View Related

General :: Embed Expect In Bash Script

May 14, 2010

I am trying to embed expect in my bash script to perform some tasks

USER="username"
PASS="password"
NAMES=`cat full_list`
for i in $NAMES
do
echo $i

[Code]....

The script initially reads a files containing a list of rpm's on each line and then spawns the rpm2ipc command which uploads the particular rpm to a repository. During this process it tries to enter the credentials, where it is failing.

View 3 Replies View Related

Software :: Exit Expect If Prompt Does Not Match?

Dec 23, 2010

We have a vendor supplied device that requires user interation, so we are using expect to automate the process. unfortunately the vendor may change the prompts as we take patches, which breaks our expect script. What I need to do is find a way to evaluate whether or not the prompt expect receives matches and if it doesn't I want the script to exit and throw an error. Currently it times out and then moves on to the next prompt.

How do I make my expect script exit if the prompt doesn't match?

View 1 Replies View Related

Software :: Using Expect To Execute Remote Commands?

Dec 21, 2010

I'm trying to get Expect to execute commands on a remote server using SSH with username/password authenticationMy current expect script is

Code:
#!/usr/bin/expect -f
spawn ssh -tq root@my_hostname "whoami"

[code]...

View 2 Replies View Related

Programming :: Expect: Reacting On A $ At The Beginning Of A Line?

Oct 17, 2010

I am having some difficulties with an expect script. What I want is that as soon as expect sees a newline followed by a dollarsign ($), that interact is done. So I would expect something like this to work:

Code:
"
$" { interact }
However it doesn't.
This is debugging output:
Code:
expect: continuing expect
expect: does " " (spawn_id exp6) match glob pattern "#"? no

[Code]...

View 3 Replies View Related

Programming :: Expect Script To Install Java - Not Getting It?

Mar 25, 2010

just as an excercise I'm trying to write a script that would automaticly install java using an expect script.I create the expect script with autoexpect and it works. But only if I don't change the size of the window. It always hang at the line with "--More--". So I changed the script and it boiled down to this

Code:
set force_conservative 0 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally

[code]....

View 3 Replies View Related

Programming :: Expect Script To Telnet Into A Router

Jul 29, 2010

I have a Thomson TG784 router, where I would like to log in automatically and execute dhcp server lease flush command.

When I log in using telnet, the process is following:

Code:

View 6 Replies View Related

Programming :: Expect/TCL - Unable To Get The Correct Results

Feb 8, 2011

I'll post the entire code here, and then specifically highlight what is just failing in a fashion I'm apparently incapable of fixing a few hours later:

Code:

#!/usr/bin/expect
# The script should be called with a file in the directory called sshServerList
# That file has the following format:
# Line # | Contents of line

[code]....

I've had all kinds of different results and problems, but I've never been able to successfully log into multiple servers, though the first server in the list most times works okay (though might not on this iteration). I'm a bit hack and slash and I would be very greatful not only for a solution, but any tips on how I should have done this and places where I could clean up my code.

View 1 Replies View Related

Programming :: Expect/Tcl Function To Login In A Router?

Nov 19, 2010

I want to write a function in expect/tcl which logins into a router. but the syntax is a little confusing .

case 1: router prompts for "username".. {we put in username and password .. if they are incorrect we try with another username and password. if we succeed into getting a prompt we return 1 .. if both username passwords are wrong or we time out we return 0 }

case 2: router prompts for "login" .. {we put in username and password .. if they are incorrect we try with another username and password. if we succeed into getting a prompt we return 1 .. if both username passwords are wrong or we time out we return 0 }

case 3: router prompts for "password" only .. { we login just using the password and get to the enable prompt}

View 3 Replies View Related

Programming :: Expect Command And Multiple Arguements?

Oct 4, 2010

I have the following code which I've thieved from here, there and everywhere:

Code:
[root@localhost /]# cat autossh
#!/usr/bin/expect -f

[code]....

View 3 Replies View Related

Programming :: Use Bind Variables In An Expect Script?

Feb 8, 2011

I am writing an expect script and I wish to use environment variables that are defined outside of the script.

View 2 Replies View Related

Programming :: TCL / Expect - IF Results Are Different Then Send A Command?

Dec 11, 2010

trying to see IF i dont get the right results repeat the command until it will or quit after 3 tries....

expect -exact "->"
send -- "test_read_register 0,0x37
"
if {! [regexp {Address 0x00000000} do send -- "test_read_register 0,0x37

[code]....

It should read

Read: Address 0x00000037, Data: 0x0000000b

but sometimes it comes out to this

Read: Address 0x00000000, Data: 0x00000000

therefore ill have to run the command again IF I Dont get the right results...

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved