AwsInspector\Ssh\Connection::closeMuxConnections PHP Метод

closeMuxConnections() публичный статический Метод

Close all multiplexed connections
public static closeMuxConnections ( )
    public static function closeMuxConnections()
    {
        $count = count(self::$multiplexedConnections);
        if ($count) {
            echo "Closing {$count} multiplexed connections...\n";
            foreach (self::$multiplexedConnections as $key => $connection) {
                exec("ssh -O stop -o LogLevel=QUIET -S {$connection} > /dev/null 2>&1");
                unset(self::$multiplexedConnections[$key]);
            }
        }
    }

Usage Example

Пример #1
0
<?php

define('CWD', getcwd());
if (is_readable(CWD . DIRECTORY_SEPARATOR . '.env.default')) {
    $dotenv = new Dotenv\Dotenv(CWD, '.env.default');
    $dotenv->overload();
}
if (is_readable(CWD . DIRECTORY_SEPARATOR . '.env')) {
    $dotenv = new Dotenv\Dotenv(CWD);
    $dotenv->overload();
}
register_shutdown_function(function () {
    \AwsInspector\Ssh\Connection::closeMuxConnections();
});