When debugging these sort of scripts you should have a much shorter timeout. You don't want to wait for 60 seconds for expect to tell you it missed something:
Code:
set timeout 3
Once it's working OK then bump you timeout up to a reasonable value, I still think 60 seconds it too long for a login prompt or for those simple commands to complete.
Hi,
Does anybody know how to change the password on multiple servers with a script. I have 300 Sun boxes and the password expiry is set to 30 days. Im in a process to build a script using expect. Need a help from an expert who has already done it.
Regards,
Vinod (1 Reply)
Could someone please help me...I have an expect script. There's a need for a log in during the script and a password is required...right now the password is just a variable in the expect script...what would be the best way to put that in an encrypted flat file and have the expect script pull the... (2 Replies)
Hello folks
I have a conf file ,say 'pass.conf' ,which is storing ascii password : PASS1111.
I need to encrypt this password once and store it in a file.
I ,then need to write a script which would read this encrypted password and decrypts it.The o/p o this script shud be this decrypted... (8 Replies)
All,
I am trying to use expect to send SFTP password because I am unable to share a key with the vendor.
They gave me a password that uses some symbols in it like $ and !
When i try to use the send command in expect it thinks the $ is a variable.
Is there anyway to have it send the... (2 Replies)
Hi
I am new to expect. Please if any one can help on my issue its really appreciable. here is my issue:
I want expect script for random passwords and random commands generation.
please can anyone help me?
Many Thanks in advance (0 Replies)
How can I pass password in SSH command without using expect in a shell program.
I don't have expect installed on my Solaris server.
#!/bin/bash
ssh user@hotname (how to supply pass in script?:wall:)
Experts please help its very urgent.
Shrawan Kumar Sahu (4 Replies)
Hi
I'm trying to run a script " abc.sh" which triggers "use.sh" .
abc.sh is nothing but a "expect" script which provides username and password automatically to the use.sh script.
Please find below the scripts:
#abc.sh
#!/usr/bin/expect -f
exec /root/use.sh
expect "*name*"
send... (1 Reply)
Hello All,
I hope someone could help me with this.
I'm creating a shell script to run a process. The trouble is, part of the process has to be ran as a different user. I can 'su' to the user ok, but I'm having trouble passing a 'cd' command as well as some variables I set earlier in the... (1 Reply)
Dear All,
I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
I need to copy python script file to around 100 servers using expect script.
1. Copy script to my user home first(/home/myhome) on each remote server
2. change permissions on copied file to 766.
3. sudo to appuser1 account on remote server. copy script file from my user home to /usr/bin/... (1 Reply)
Discussion started by: kchinnam
1 Replies
LEARN ABOUT PHP
mongocursor.timeout
MONGOCURSOR.TIMEOUT(3) 1 MONGOCURSOR.TIMEOUT(3)MongoCursor::timeout - Sets a client-side timeout for this query
SYNOPSIS
public MongoCursor MongoCursor::timeout (int $ms)
DESCRIPTION
A timeout can be set at any time and will affect subsequent queries on the cursor, including fetching more results from the database.
PARAMETERS
o $ms
- The number of milliseconds for the cursor to wait for a response. Use -1 to wait forever. By default, the cursor will wait
$30000 milliseconds (30 seconds).
RETURN VALUES
This cursor.
ERRORS /EXCEPTIONS
Causes methods that fetch results to throw a MongoCursorTimeoutException if the query takes longer than the specified number of millisec-
onds.
EXAMPLES
Example #1
MongoCursor.timeout(3) example
In the following example, the driver will wait forever for the initial database response, and then wait 100ms for subsequent
responses.
<?php
$cursor = $collection->find();
$cursor->timeout(-1);
/* $cursor->hasNext() executes the query. An infinite timeout has been set, so
* the driver will wait as long as necessary for a response.
*/
while ($cursor->hasNext()) {
$cursor->timeout(100);
/* A timeout has now been set, so if the cursor needs to get more results
* from the database, it will only wait 100ms for a response.
*/
try {
print_r($cursor->getNext());
} catch (MongoCursorTimeoutException $e) {
echo "query took too long!";
}
}
?>
NOTES
Warning
This does not cause the MongoDB server to cancel long-running operations; it only instructs the driver to stop waiting for a
response and throw a MongoCursorTimeoutException after a set time. If you need to specify a server-side timeout for a query, con-
sider using MongoCursor::maxTimeMS.
SEE ALSO
MongoCursorInterface::timeout, The socketTimeoutMS option for MongoClient.__construct(3).
PHP Documentation Group MONGOCURSOR.TIMEOUT(3)