8 More Discussions You Might Find Interesting
1. UNIX and Linux Applications
Good evening, i need your help please
I will try to describe the scenario briefly: In a Telecom Production system application receives a certain files called CDRs(call detail records) to be processed by doing some operating systems operations and then database operations like creating indexes... (4 Replies)
Discussion started by: alexcol
4 Replies
2. Shell Programming and Scripting
Gents,
I did the below code to get an output (report) ,.. the code works fine but I believe it can be more shorted using better method.
Please if you can help, to generate same output improving the code , will be great.
here my code.
# get diff in time
awk '{$9=$8-prev8;prev8=$8;print... (8 Replies)
Discussion started by: jiam912
8 Replies
3. Shell Programming and Scripting
Thank you for taking the time to look at this and provide input.
To start, I am not a linux/unix expert but I muddle through the best I can.
I am also in no way shape or form a programmer. Please keep that in mind as you read this script.
This script is designed to find all files in a given... (8 Replies)
Discussion started by: garlandxj11
8 Replies
4. Shell Programming and Scripting
I'm obviously very new to this. I'm trying to write a simple for loop that will read the directory names in /Users and then copy a file into the same subdir in each user directory.
I have this, and it works but it isn't great.
#!/bin/bash
HOMEDIRS=/Users/*
for dirs in $HOMEDIRS; do
if ];... (5 Replies)
Discussion started by: Heath_T
5 Replies
5. Shell Programming and Scripting
Hi guys, I use this function which was provided to me by someone at this site. It works perfectly for validating a users input option against allowed options..
example:
validateInput "1" "1 3 4 5" would return 0 (success)
function validateInput {
input=$1
allowedInput=$2
for... (4 Replies)
Discussion started by: pyscho
4 Replies
6. Shell Programming and Scripting
I found a way to make a numeric variable persistent for a script :
#!/bin/bash
function Persist() { # 1:Expression like VARIABLE=Value (numeric)
local V=${1%=*}
eval "$1"
sed -i "s/^$V=*/$1/" $(which $(basename $0)) || return 1
}And how to use itAA=12
read -p "Enter a... (2 Replies)
Discussion started by: frans
2 Replies
7. UNIX for Dummies Questions & Answers
Kindly any advice to improve my unix skills as electronic books i can download or valuable sites as this one etc... (3 Replies)
Discussion started by: sak900354
3 Replies
8. Shell Programming and Scripting
Hi;
I want to access our customer database to retreive all clients that have as language index 2 or 3 and take their client number.
My input is a file containing all client numbers.
i access the data base using a function call "scpshow". The total number of clients i want to scan is 400 000... (6 Replies)
Discussion started by: bcheaib
6 Replies
MONGOCLIENT.CLOSE(3) 1 MONGOCLIENT.CLOSE(3)
MongoClient::close - Closes this connection
SYNOPSIS
public bool MongoClient::close ([boolean|string $connection])
DESCRIPTION
The MongoClient.close(3) method forcefully closes a connection to the database, even if persistent connections are being used. You should
never have to do this under normal circumstances.
PARAMETERS
o $connection
- If connection is not given, or FALSE then connection that would be selected for writes would be closed. In a single-node config-
uration, that is then the whole connection, but if you are connected to a replica set, close() will only close the connection to
the primary server. If connection is TRUE then all connections as known by the connection manager will be closed. This can
include connections that are not referenced in the connection string used to create the object that you are calling close on. If
connection is a string argument, then it will only close the connection identified by this hash. Hashes are identifiers for a con-
nection and can be obtained by calling MongoClient.getConnections(3).
RETURN VALUES
Returns if the connection was successfully closed.
EXAMPLES
Example #1
MongoClient.close(3) example
This example demonstrates how to selectively close all connections for secondaries only.
<?php
// Connect to a replicaset
$a = new MongoClient("mongodb://whisky:13000/?replicaset=seta");
$connections = $a->getConnections();
foreach ( $connections as $con )
{
// Loop over all the connections, and when the type is "SECONDARY"
// we close the connection
if ( $con['connection']['connection_type_desc'] == "SECONDARY" )
{
echo "Closing '{$con['hash']}': ";
$closed = $a->close( $con['hash'] );
echo $closed ? "ok" : "failed", "
";
}
}
?>
The above example will output:
Closing 'whisky:13001;X;4948': ok
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 1.3.0 | |
| | |
| | The $connection parameter to this function was |
| | added in 1.3.0. Before that, only the write con- |
| | nection would be closed by this method. |
| | |
| 1.2.0 | |
| | |
| | Before version 1.2.0 the driver would not use |
| | persistent connections by default, and all con- |
| | nections would be closed as soon as a MongoDB |
| | connection went out if scope. Since version 1.2.0 |
| | this is no longer the case and it is a bad idea |
| | to call close as you might end up overloading the |
| | server with connections under high load. |
| | |
+--------+---------------------------------------------------+
SEE ALSO
MongoClient.getConnections(3).
PHP Documentation Group MONGOCLIENT.CLOSE(3)