如果使用 PHP-SSH2 的远程 SSH 服务器中存在目录“xyz”,我如何重新启动?
<?php
function fsmoke_ping($command_name1, $menu_name1, $title_name1, $host_ip1)
{
$connection = ssh2_connect('http://xxxx.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$sftp = ssh2_sftp($connection);
$handle = file_exists('ssh2.sftp://' . $sftp . '/etc/xyz/devices/$menu_name1', 'w+') or die('Cannot open file: '.$menu_name1);
$data = "++$menu_name1\nprobe = $command_name1\n menu = $menu_name1\n title = $title_name1\n host = $host_ip1";
fwrite($handle, $data);
fclose($handle);
exec(`sudo /etc/init.d/xyz reload`);
}
?>
在这,
exec(`sudo /etc/init.d/xyz reload`);
不工作。所以我怎么能在这里重新启动它?