Witam.
Piszę mały panel na własne potrzeby,
Mam taki kodzik
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>serwer</title>
</head>
<body>
<?php
$start = $_GET['start'];
$stop = $_GET['stop'];
$restart = $_GET['restart'];
$dir = array("/home/hlds1"); for($i=0;$i<count($dir);$i++){
print $i.".".$dir[$i].'<form action="" method="GET"> <a href="panel.php?start='.$i.'">Start</a> <a href="panel.php?stop='.$i.'">Stop</a> <a href="panel.php?restart='.$i.'">Restart</a>
</form>';
}
if($stop!="") {
//$out = `ps -aux | grep SCREEN -A -m -d -S hlds*`;
class KillAllProcesses {
function killallprocesses() {
$this->listItems();
}
function listItems() {
$output = shell_exec('ps -x| grep hlds'.$_GET['stop']); $this->output($output);
$this->doKill($array);
}
function output($output) {
print "<pre>".$output."</pre>"; }
function doKill($array) {
for ($i = 1; $i < count($array); $i++) { }
}
}
new KillAllProcesses();
}
?>
</body>
</html>
Pokombinowałem trochę i wyszło mi coś takiego ale w tej linii
Kod
$output = shell_exec('ps -x| grep hlds'.$_GET['stop']);
jak dodaję to :
Kod
| grep hlds'.$_GET['stop']
to nie wyświetla mi procesu oprócz
Kod
28245 ? R 0:00 sh -c ps -x| grep hlds1
Może proc_open ? Tylko, że nie wiem jak tego użyć :]
Pozdrawiam
Ten post edytował botnaizi 11.10.2010, 21:14:06