Quantcast
Browsing all 157 articles
Browse latest View live

Expect script + automated telnet process between three Linux machines

Is it possible to do the following by expect script? I have Linux server that connected to linux_machine1 and linux_machine1 connected to linux_machine2 My Linux server have access only to...

View Article


Regular expressions with ExpectJ

I've been used the ExpectJ Java library to automate some jobs on a Linux server, however now I need to automate a job that sends a different text response for each execution. Here is the output: Last...

View Article


Log the output of Expect command

I have made the below expect script and I need to log the output of that script. SOURCE_FILE=`ls -l *.txt --time-style=+%D | grep ${DT} | grep -v '^d' | awk '{print $NF}' ` if [ -n "${SOURCE_FILE}" ]...

View Article

Use a script for a telnet session

I have a problem with my script. It seems my password is wrong. #!/usr/bin/expect set ip [lindex $argv 0] spawn telnet $ip set timeout 10 expect "Login:" send "administrator\r" expect "Password:" send...

View Article

How to use EXPECT in a loop foor ssh

Our Linux setup doesn't have keygen configured for password less authentication. Hence I am supposed to use only EXPECT for password less authentication in a shell script. /usr/bin/expect<<EOF...

View Article


spawn - command not found!

I am using Mac OS X 10.9.4, following is my script to copy files from local machine to different host #!/bin/bash #!/usr/bin/expect echo "I will fail if you give junk values!!" echo " " echo "Enter...

View Article

expect script for getting output for multiple servers

I am trying to get output of IQN from multiple servers. I am getting the below error. Error output spawn /usr/bin/ssh VM2 | /usr/bin/cat /etc/iscsi/initiatorname.iscsi root@VM2's password: bash: -c:...

View Article

Autoexpect hangs at the end of the script

I have an autoexpect script. I modified it and it works great, however when it finish to run it hangs and I need to do ctrl+C in order to get my terminal [..] 887VA#logout Connection to 10.255.255.1...

View Article


Get the output from expect script in a variable

I have an expect script which provides the IP address: #!/bin/expect -f set nodename [lindex $argv 0] spawn virsh console $nodename expect "Escape character is" send "\n" expect "localhost login: " {...

View Article


Executing stdout results line by line that has a prompt confirmation

I have a command that (potentially) prints several lines and then I want to execute them one by one (using xargs for example, or anything else): find . -name "*string*" -print | awk '{ print "echo "...

View Article

Image may be NSFW.
Clik here to view.

Expect script embedded in shell: how to specify value defined in remote shell?

1. Problem description:I have a script which needs to ssh to an remote server and run some scripts.But I met some troubles when trying to use values that defined in remote server.I use "\$" to refer to...

View Article

Repeatable Options Expect/Bash Telnet Listener

Hey guys first time post.Trying to determine if it is possible create a bash/expect file combination that can serve as a Gameserver Moderation Bot. It spawns and listens on telnet.It would ideallySpawn...

View Article

I need to ssh into another machine using expect and a password and start a...

As said in the title, I am writing a script that should run on Computer A. Computer A should ssh on Computer B, run Program B, then exit the ssh session (Program B still running on Computer B) and then...

View Article


Not Getting output of Expect Script in Crontab

I've created an Expect Script (.exp) to get the raw file in other server. Then, I also have .sh file to call my .exp. It's working well when I tried to run it in a usual way (./call_expect.sh). But...

View Article

Expect script to download newest file from remote server with grep

I have an expect script to download the lastest database backup from a remote server. I am new to shell/expect scripting and I am struggeling with storing a clean filename from the output buffer in a...

View Article


Expect - parse all occurrences of a pattern and store in a variable

I am trying to process multiple mac addresses from output of a program. Output is in below format -Device B0:CA:68:CF:88:54 dev1 Device DC:16:B2:AE:FB:8F dev2 Device B0:CA:68:CF:88:11 dev3 Device...

View Article

expect script to get its directory ?

a bash script can be BASEDIR=$(dirname $0) but how do I do that in expect script ? If I use BASEDIR=[dirname $argv0] I get the error "invalid command name "dirname".

View Article


How can I "source" expect script

I'm forced to use a script like below:# test.sh function my_fun { echo "Give value for FOO" local my_var read my_var export FOO=$my_var } # Call my_fun function my_fun by sourcing it from my shell.$...

View Article

expect redirect incomplete output in rhel 7.5

Can any one help me out with redirecting shell out. [root@localhost automation]# vi cs300.sh #!/usr/bin/expect -f set timeout -1 spawn ssh Monitor@172.30.19.96 expect "Password" send "Password\r"...

View Article

Unix Shell script using expect

I am new to using expect. I am running the below code to get the token from a server:set timeout 20 set token "" sleep 1 spawn ssh -l $serveruser1 $serverip # -- is used to disable the interpretion of...

View Article
Browsing all 157 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>