Sponsored Content
Top Forums Shell Programming and Scripting Calling Expect Script - Telnet Post 302548035 by trinak96 on Wednesday 17th of August 2011 10:03:14 AM
Old 08-17-2011
Correct, running with manual IP argument works.
Output from run with trace :
Code:
/Scripts$ ./get-int
+ read ipadd
+ echo 10.33.220.12
10.33.220.12
+ export ipadd
+ sh ./list-int 10.33.220.12
./list-int: 17: spawn: not found
couldn't read file "Username:": no such file or directory
./list-int: 19: send: not found
couldn't read file "Password: ": no such file or directory
./list-int: 21: send: not found
couldn't read file ">": no such file or directory
./list-int: 23: send: not found
couldn't read file "Password: ": no such file or directory
./list-int: 25: send: not found
couldn't read file "#": no such file or directory
./list-int: 28: send: not found
couldn't read file "#": no such file or directory
./list-int: 30: send: not found
couldn't read file "#": no such file or directory
./list-int: 32: send: not found

and repeat for every entry in dev-list file.


Thanks again....

Last edited by Scott; 08-17-2011 at 12:51 PM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling an Expect script from a Webpage using PHP

I have a webpage that is in HTML and PHP. In PHP I have tried using exec, system, shell_exec and passthru functions to call an Expect Script file (temp.exp). This Expect file spawns a telnet session that uses "expect/send" commands to retrieve information from an environmental unit (not a normal... (0 Replies)
Discussion started by: CCUSmith
0 Replies

2. Shell Programming and Scripting

Calling Expect script in Perl...

I call a EXPECT script from my perl script with machine IP and a FIle. The script logins to the machine and exports the value. The values to be exported or stored in a file. I have close to 10 machines and I have created 10 files and pass the corresponding files in command line, Now I could like... (4 Replies)
Discussion started by: ramkriz
4 Replies

3. Shell Programming and Scripting

Telnet Expect script question

Hi all, I have written a small expect script which should spawn a telnet session login and execute some commands. #!/usr/bin/expect -f spawn telnet $env(IP) match_max 100000 expect "login:" send -- "******\n" expect -exact "Password:" send -- "****\n" expect "%" Now I have got... (2 Replies)
Discussion started by: stinkefisch
2 Replies

4. Shell Programming and Scripting

calling expect script in ksh is failing via cron

I'm calling an expect script via a ksh script in cron and it is failing. The script runs fine if i run it manually. Does anyone know if it is an issue with compatibilty and if there is a way around it? (2 Replies)
Discussion started by: bhatia
2 Replies

5. Shell Programming and Scripting

ssh is not working while calling through expect shell script

Hi, Please share you experience and way out on below error:--> #!/bin/bash -xv FILE=login.txt + FILE=login.txt CONNECT=sshlogin.exp + CONNECT=sshlogin.exp SERVERNAME=$1 + SERVERNAME=192.168.12.1 MyServer="" + MyServer= MyUser="" + MyUser= MyPassword="" + MyPassword= exec 3<&0 +... (6 Replies)
Discussion started by: manish_1678
6 Replies

6. Shell Programming and Scripting

Calling Shell Script from Expect...

Hi there, I need some help regarding the execution of shell script from expect as the method I am trying is giving me error. I wrote an shell program which takes two arguments to telnet to a device and saves the output in a file. Following is the script.... (0 Replies)
Discussion started by: cyberparanoid
0 Replies

7. Shell Programming and Scripting

Calling a function which uses expect from a shells script

Hi all, This is the first time i am using expect. I am trying to call a function with in the shell script. The function will shh to a new server and will pass the password using expect and send. I need help in calling the fuction i am getting follaowing errors... here the script ... (8 Replies)
Discussion started by: firestar
8 Replies

8. Programming

Calling expect script inside another expect

Hi, Am very new to expect scripting.. Can You please suggest me how to call an expect script inside another expect script.. I tried with spawn /usr/bin/ksh send "expect main.exp\r" expect $root_prompt and spawn /usr/bin/ksh send "main.exp\r" expect $root_prompt Both... (1 Reply)
Discussion started by: Priya Amaresh
1 Replies

9. Programming

Calling another expect script inside an expect script

I have an expect script called remote that I want to call from inside my expect script called sudoers.push, here is the code that is causing me issues: set REMOTE "/root/scripts/remote" ... log_user 1 send_user "Executing remote script as $user...\n" send_user "Command to execute is: $REMOTE... (1 Reply)
Discussion started by: brettski
1 Replies

10. Shell Programming and Scripting

Password check in bash script calling on expect

password check in bash script calling on expect Background: I have to copy a file from one server, to over 100 servers in a test environment. once the file is copied, it requires to have the permissions on the file changed/verified. These are all linux servers. most of them have the same... (1 Reply)
Discussion started by: 2legit2quit
1 Replies
MONGOCURSOREXCEPTION(3) 						 1						   MONGOCURSOREXCEPTION(3)

The MongoCursorException class

INTRODUCTION
Caused by accessing a cursor incorrectly or a error receiving a reply. Note that this can be thrown by any database request that receives a reply, not just queries. Writes, commands, and any other operation that sends information to the database and waits for a response can throw a MongoCursorException. The only exception is new MongoClient() (creating a new connection), which will only throw MongoConnectionEx- ceptions. This returns a specific error message to help diagnose the problem and a numeric error code associated with the cause of the exception. For example, suppose you tried to insert two documents with the same _id: <?php try { $collection->insert(array("_id" => 1), array("w" => 1)); $collection->insert(array("_id" => 1), array("w" => 1)); } catch (MongoCursorException $e) { echo "error message: ".$e->getMessage()." "; echo "error code: ".$e->getCode()." "; } ?> error message: E11000 duplicate key error index: foo.bar.$_id_ dup key: { : 1 } error code: 11000 The following is a list of common errors, codes, and causes. Exact errors are in italics, errors where the message can vary are described in obliques. o cannot modify cursor after beginning iteration Code: 0 You are calling a method that sets up the query after executing the query. Reset the cursor and try again. An example: <?php try { $cursor = $collection->find(); var_dump($cursor->getNext()); // getNext() queried the database, it's too late to set a limit $cursor->limit(1); } catch (MongoCursorException $e) { echo "error message: ".$e->getMessage()." "; echo "error code: ".$e->getCode()." "; } // this will work, though: $cursor->getNext(); $cursor->reset(); $cursor->limit(1); ?> o Get next batch send errors Code: 1 Could not send the query to the database. Make sure the database is still up and the network is okay. o cursor not found Code: 2 The driver was trying to fetch more results from the database, but the database did not have a record of the query. This usually means that the cursor timed out on the server side: after a few minutes of inactivity, the database will kill a cursor (see MongoCursor.immortal(3) for information on preventing this). An example: <?php try { $cursor = $collection->find(); $cursor->getNext(); // sleep for 15 minutes sleep(60*15); while ($cursor->hasNext()) { $cursor->getNext(); } } catch (MongoCursorException $e) { echo "error message: ".$e->getMessage()." "; echo "error code: ".$e->getCode()." "; } ?> o cursor->buf.pos is null Code: 3 This may indicate you are out of RAM or some other extraordinary circumstance. o couldn't get response header Code: 4 A common error if the database or network goes down. This means that the driver couldn't get a response from the connection. o no db response Code: 5 This may not even be an error, for example, the database command "shutdown" returns no response. However, if you were expecting a response, this means the database didn't give one. o bad response length: %d, did the db assert? Code: 6 This means that the database said that its response was less than 0. This error probably indicates a network error or database corruption. o incomplete header Code: 7 Highly unusual. Occurs if the database response started out correctly, but broke off in the middle. Probably indicates a network problem. o incomplete response Code: 8 Highly unusual. Occurs if the database response started out correctly, but broke off in the middle. Probably indicates a network problem. o couldn't find a response Code: 9 If the response was cached and now cannot be located. o error getting socket Code: 10 The socket was closed or encountered an error. The driver should automatically reconnect (if possi- ble) on the next operation. o couldn't find reply, please try again Code: 11 The driver saves any database responses it cannot immediately match with a request. This exception occurs if the driver has already passed your request's response and cannot find your response in its cache. o error getting database response: errstr WSA error getting database response: errstr "errstr" is an io error reported directly from the C socket subsystem. On Windows, the error message is prefixed with "WSA". o Timeout error Code: 13 If there was an error while waiting for a query to complete. o couldn't send query: <various> Code: 14 C socket error on send. o max number of retries exhausted, couldn't send query Code: 19 The driver will automatically retry "plain" queries (not commands) a couple of times if the first attempt failed for certain reasons. This is to cause fewer exceptions during replica set failover (although you will probably still have to deal with some) and gloss over transient network issues. This can also be caused by the driver not being able to reconnect at all to the database (if, for example, the database is unreachable). Version 1.2.2+. ERRORS PASSED THROUGH BY THE DATABASE
Database errors should always trigger MongoCursorExceptions on queries. Error messages and codes are sent directly from the database and you should be able to see matching errors in the database log. A few common database errors are listed below: o E11000 duplicate key error index: foo.bar.$X dup key: { /* ... */ } Code: 11000 Database error for duplicate keys. o not master Codes: 10107, 13435, and 10058 Not master errors, piped through by the database. ach of these will cause the driver to disconnect and attempt to find a new primary. The actual error you get on failover may not be a "not master" error, depending on when the change in primary occurs. CLASS SYNOPSIS
MongoCursorException MongoCursorExceptionextends MongoException PHP Documentation Group MONGOCURSOREXCEPTION(3)
All times are GMT -4. The time now is 02:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy