Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [inne][PHP]Wyodrębnienie procesu i zabicie go
botnaizi
post
Post #1





Grupa: Zarejestrowani
Postów: 72
Pomógł: 0
Dołączył: 8.12.2009

Ostrzeżenie: (0%)
-----


Witam.

Piszę mały panel na własne potrzeby,
Mam taki kodzik
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>serwer</title>
  6. </head>
  7.  
  8. <body>
  9. <?php
  10. $start = $_GET['start'];
  11. $stop = $_GET['stop'];
  12. $restart = $_GET['restart'];
  13. $dir = array("/home/hlds1");
  14. $players = array("20");
  15. for($i=0;$i<count($dir);$i++){
  16. print $i.".".$dir[$i].'<form action="" method="GET">
  17. <a href="panel.php?start='.$i.'">Start</a> <a href="panel.php?stop='.$i.'">Stop</a> <a href="panel.php?restart='.$i.'">Restart</a>
  18.  
  19. </form>';
  20. }
  21. if($stop!="") {
  22. //$out = `ps -aux | grep SCREEN -A -m -d -S hlds*`;
  23.  
  24. class KillAllProcesses {
  25. function killallprocesses() {
  26. $this->listItems();
  27. }
  28. function listItems() {
  29.  
  30. $output = shell_exec('ps -x| grep hlds'.$_GET['stop']);
  31. $this->output($output);
  32. $array = explode("\n", $output);
  33. $this->doKill($array);
  34. }
  35. function output($output) {
  36. print "<pre>".$output."</pre>";
  37. }
  38. function doKill($array) {
  39. for ($i = 1; $i < count($array); $i++) {
  40. $id = substr($array[$i], 0, strpos($array[$i], ' ?'));
  41. print $id."<br />";
  42. }
  43. }
  44. }
  45.  
  46. new KillAllProcesses();
  47.  
  48.  
  49.  
  50. }
  51.  
  52.  
  53.  
  54. ?>
  55.  
  56. </body>
  57. </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
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 01:31