« ssh2_send_eof
ssh2_set_timeout »

ssh2_send_signal

(PECL ssh2 >= 1.5.0)

ssh2_send_signal — Send a signal to a remote process

説明

function ssh2_send_signal(resource $channel, string $signal): bool

Sends a signal to the process running at the remote end of the given channel.

注意:

This function is only available when the extension is built against libssh2 >= 1.9.0.

パラメータ

channel

An SSH channel stream, as returned by ssh2_exec() or ssh2_shell().

signal

The name of the signal to send, without the SIG prefix, as defined by the SSH connection protocol (» RFC 4254); for example TERM, KILL or INT.

The value is forwarded to the server as is; it is not validated against the names listed by the protocol.

戻り値

成功した場合に true を、失敗した場合に false を返します。

エラー / 例外

An E_WARNING is emitted when channel is not an SSH channel stream, and when the signal could not be sent.

例

例1 Interrupting a remote command

<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');

$stream = ssh2_exec($connection, 'trap "echo interrupted" INT; sleep 60');

ssh2_send_signal($stream, 'INT');

stream_set_blocking($stream, true);
echo stream_get_contents($stream);
?>

参考

関連キーワード:
signal   stream   send   channel   remote   process   connection   Send   exec   shell   against   protocol   example   password   timeout   resource   Sends   running   given   available   extension   built   libssh   returned   without
関連する関数・ページ:
swoole-process.signal   function.ssh2-send-eof   swoole-process.kill   event.signal   event.constructing.signal.events   function.pcntl-signal-get-handler