The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
0answers
12 views

less doesn't work in LXC container

I'm experiencing some trouble running less and expect inside LXC container (whether using console or SSH) Expect won't work before I won't add an "interact" anywhere in the script, and less doesn't ...
-1
votes
1answer
99 views

Bash Script - Expect does not send password that ends with $!. Also need improvement to report connection timed out

Update: Password issue is fixed and connection timed out message was fixed too. Adding \ before $! worked. Example: *password\$! set passwds { *password\$! @tempP@ss %Test4%} For connection timed ...
1
vote
2answers
162 views

Expect script error send: Spawn id exp4 not open while executing

Update: Working code added here for others CREDITS to : http://serverfault.com/users/30957/glenn-jackman @Glenn I'm sorry! just apologizing and I mean it! Sorry Glenn your code need few changes ...
0
votes
1answer
40 views

How to distribute root files with expect?

I've recently learned how great expect is, now that I'm suddenly responsible for managing 150 VMs. I've been using it to distribute config files to remote servers, but there's got to be a better way ...
0
votes
1answer
67 views

SELinux problems running Expect script from fail2ban

I have an Expect script that works fine if I run it manually, but fails when run as an action from Fail2ban. The error message is as follows: spawn /usr/bin/telnet 192.168.242.1 The system has no ...
2
votes
1answer
1k views

Ansible ssh as user and execute has root (expect like)

I have to administer an important number of hosts where there is only one user able to access from SSH (let's call him foo) and then have to login as root to execute privilegied commands. Foo user ...
2
votes
2answers
78 views

How to keep script from swallowing all of stdin?

I have a script that reads from a pipe in a loop and runs an expect script and a normal shell script in the loop. Both scripts run ssh to another server to grab a piece of data. For example: cat ...
0
votes
0answers
23 views

FTP automated user password maintenance

We have a need to automate a FTPS transfer using named accounts which require periodic password resets. Due to another party having control over the accounts, we cannot change them to service accounts ...
0
votes
0answers
51 views

expect not working well with router banner messages

I'm using expect-lite to communicate with a router. however the router has some customized banner message set and expect doesn't seem to work very well with it. Specifically, when I login in to the ...
2
votes
2answers
156 views

Router config export via expect script - username in enable?

I'm working on an Expect script for pulling configuration information from my hosts. The problem is that some of my hosts (when the enable command is entered) will prompt for both a login and ...
0
votes
0answers
217 views

expect: how to use expect scripts from within a bash subroutine

I want to write a login script in expect. But I want this to be reused in different other scripts. I want to make all the login commands part of a bash subroutine. ie instead of expect_login.sh ...
1
vote
2answers
333 views

Error while installing php extension 'expect'

I got some serious error while installing expect extension in PHP. I ran sudo pecl install channel://pecl.php.net/expect-0.3.1 I got error like this while running make, running: make /bin/bash ...
0
votes
1answer
268 views

expect script works fine standalone not from bash script

I am running a expect script,which login to a server check if iptables running and return the log file of the status. There is a hostfile also given with server list and password, expect is being ...
0
votes
1answer
302 views

screen, expect and scripted detached interaction

Trying to write a bash script which will open a screen, start a python application, and interact with the python interaction as required when it is first started. If not possible in screen, I would ...
0
votes
1answer
572 views

expect script not working with bash script

I want a script that ssh to remote server and then run a script which is at my local machine and then store the output on my local machine Expect script for ssh to remote server: #!/usr/bin/expect ...
0
votes
1answer
88 views

What could block the output of a command?

Sometimes I'll attempt a (2>&1) redirection and some/all of the resulting output appears to be silenced. e.g. wget -O- http://localhost/test.txt 2>&1 I would expect to see a merge of ...
0
votes
1answer
398 views

expect script + how to perform case in expect script

the following expect script target is to print the hostname name from linux/solaris machine and according to hostname results expect script will run linux.ksh or solaris.ksh script ...
0
votes
1answer
326 views

expect script + write “if” in expect script

please advice what's wrong with my exepct syntax ( I run expect in ksh script on Solaris 10 machine ) I want to verify if OS is linux so if it true the expect check if prompt is "#" or ">" and ...
3
votes
2answers
409 views

expect script to support two expected characters

I want to run sshd restart on Linux and Solaris machine via expect ( my expect run in my ksh script ) I create expect script so when expect see the prompt "#" then he run sshd restart but the ...
2
votes
1answer
160 views

kill screen session in an expect script

I start my screen connection with a spawn command within an expect script: spawn screen /dev/... But I don't know how I can kill the screen when the script is finished
2
votes
1answer
701 views

Sending content of a file in Expect

How Can I send the content of a file in Expect? Do I have to use cat command in a way? if yes how? lets say my file is called 1.txt. example: expect "Enter command to send:" {send "???? \r"} ???? ...
0
votes
2answers
4k views

expect + how to install expect on solaris

subject - install expect on solaris in order to write expect scripts details from my machine: uname -a SunOS 5.10 Generic_139555-08 sun4v sparc SUNW,Netra-T5220 I installed Solaris machine ( ...
1
vote
1answer
352 views

How to listen for SNMP Traps from SNMP enabled network devices?

I just began working for my school's networking department, and I was assigned a project to develop a program to listen for traps from SNMP network devices. The device I am testing with an Access ...
0
votes
2answers
222 views

Httpd + Expect Script Fail (no more ptys) if httpd is not run through cli

I have a CentOS virtual server through Vmware. The server runs an httpd daemon which serves an php page with a form. The users complete the form, and by clicking submit the php page calls an expect ...
4
votes
2answers
1k views

expect + how to identify if expect break because time out?

The target of the following simple expect script is to get the hostname name on the remote machine Sometimes expect script fail to perform ssh to $IP_ADDRESS ( because remote machine not active , etc ...
5
votes
3answers
2k views

SU and Run Command Using Expect

I want to su to another user, using expect, and then run a graphical program as that user. I am using kcalc to test with: #!/usr/bin/expect set timeout 20 spawn su dummy expect "Password:" send ...
0
votes
1answer
4k views

Expect Script, timeouts and error checking

I was hoping to get a little insight into an expect script that I've written. Basically we have this expect script to perform an sftp upload, key authentication is not an option, and sftp is the only ...
0
votes
2answers
1k views

Get unix 'top' command output from Expect script

All, EDIT I want to execute a unix statement in Expect script and get an output without having to include the interact statement.The unix statement outputs rsize value for a process. I haven't ...
3
votes
2answers
2k views

expect script + expect miss the send string + delay issue

I write the active.ksh script (based on expect) in order to login automatically to some Solaris machine and execute the hostname command (login to virtual IP in order to verify which hostname is the ...
1
vote
1answer
229 views

ssh + multiple ssh connection failed

I have 47 Linux client machines and one Solaris server machine (all Linux client machines are red-hat 5.1) all clients perform ssh connection to the server in order to verify if ...
1
vote
3answers
426 views

Scripting around Curses?

I have a process I'm that I'm constantly having to deal with. It requires I run a command and then enter several pieces of information. Then I'm presented with a curses menu listing several ...
1
vote
2answers
235 views

Setup a minimum workable Linux server on PC and get private IP address

The scenario is I want to use Expect to automatize some daily routine tasks to check log servers with private IP addresses. Telnet/SSH to those servers from a Linux server with public IP address won't ...
1
vote
2answers
9k views

help with expect script, run cat on remote comp and get output of it to the variable

I have a bash+expect script which has to connect via ssh to the remote comp, read the file there, find specific line with the "hostname" (like "hostname aaaa1111") and store this hostname into the ...
2
votes
3answers
3k views

Expect timeout, in Bash scripting

How do I add timeout for "expect" in the following script? I want to set it as 120 seconds. #!/bin/bash HOST="localhost" USER="myuname" PASS="mypassword" VAR=$(expect -c " spawn ssh $USER@$HOST ...
1
vote
1answer
1k views

run several bash scripts with expect code and leave them running

I have a bunch of several bash scripts that will perform some actions that require user input, therefore I'm using expect with it. However, I need one to keep running. But if I use expect, the expect ...
3
votes
1answer
972 views

How to print the name of an expect script?

In bash, I can do something like this: echo "The name of this script is $0" Is there a way to do something similar in expect?
1
vote
2answers
7k views

Simple EXPECT script to execute remote command and displat output

I am trying to connect to a network router and execute show status on it. Currently i am using: spawn ssh -o StrictHostKeyChecking=no admin@192.168.20.254 expect " * ? password:*\r" send -- ...
0
votes
2answers
781 views

Can I use expect with SCP to bypass the password prompt?

I am trying to transfer some files using SCP in a shell script, but I am being prompted for my password on the remote machine. Can I use expect with scp to enter the password so I don't have to type ...
0
votes
1answer
817 views

Linux Expect Script terminates too early

I have an expect script that I have written that at the end calls scp to copy a large file from server A to server B. The issue I have (which is the same using rsync and not scp) is that the expect ...
1
vote
3answers
3k views

Expect Script wait Command Hangs

I have an expect script embedded in a bash script: #! /bin/bash # this function runs a command like 'ssh' and provides the password function with_password { expect << END spawn $2 expect ...
3
votes
2answers
1k views

Why is `slapconfig -backupdb` not creating disk image when run from cron on Snow Leopard Server?

Years ago I put together the following expect script to perform Open Directory backups under Tiger Server and it's worked well under Leopard Server as well: #!/usr/bin/expect -f set date [timestamp ...
0
votes
2answers
278 views

Build of expect v5.43 fails with Tcl v8.5.8

I'm trying to build "expect" from source v5.43, using Tcl built from source v8.5.8 on Redhat Linux. Tcl built fine, but my attempt to build expect fails. I run configure, then make, which gives me the ...
1
vote
1answer
1k views

What is wrong with my expect script?

I'm trying to learn how to use the expect command, to help me automate deployment of some software via shell scripts, and figured I start with something simple to get me started. I've created a file ...