netlinker
08-12-2005, 19:08
Hi zusammen,
ich wollte mittels exec(ps -Aef | grep ....) bestimmte Prozesse auflisten, jedoch gibt php mit nicht die gleiche Ausgabe, wie sie auf der Shell zu sehen ist.
Die Zeilen werden nicht ganz angezeigt und auf den nicht angezeigtn Teil kann ich auch nicht mehr grep(en).
Was mache ich an dieser Stelle falsch?
Hier noch die Ausgaben, die ich erhalte.
<?
exec ("ps -Aef | grep wwwrun",$prozesse);
foreach($prozesse as $outputline){
echo("$outputline<br>");
}
?>
Ausgabe im Browser:
wwwrun 19024 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 19025 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 19026 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 19027 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 19028 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 2095 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 574 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 23261 19026 0 19:55 ? 00:00:00 sh -c ps -Aef | grep wwwrun
wwwrun 23262 23261 0 19:55 ? 00:00:00 ps -Aef
wwwrun 23263 23261 0 19:55 ? 00:00:00 grep wwwrun
Ausgabe in der Shell
# su -s /bin/bash -c "ps -Aef | grep wwwrun" wwwrun
wwwrun 19024 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19025 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19026 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19027 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19028 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 2095 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 574 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 23336 17869 0 20:03 pts/0 00:00:00 su -s /bin/bash -c ps -Aef | grep wwwrun wwwrun
wwwrun 23337 23336 0 20:03 pts/0 00:00:00 bash -c ps -Aef | grep wwwrun
wwwrun 23338 23337 0 20:03 pts/0 00:00:00 ps -Aef
wwwrun 23339 23337 0 20:03 pts/0 00:00:00 bash -c ps -Aef | grep wwwrun
<?
exec ("ps -Aef | grep wwwrun | grep conf",$prozesse);
foreach($prozesse as $outputline){
echo("$outputline<br>");
}
?>
Ausgabe im Browser:
wwwrun 23278 23275 0 19:58 ? 00:00:00 grep conf
Ausgabe in der Shell
# su -s /bin/bash -c "ps -Aef | grep wwwrun | grep conf" wwwrun
wwwrun 19024 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19025 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19026 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19027 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19028 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 2095 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 574 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 23331 17869 0 20:02 pts/0 00:00:00 su -s /bin/bash -c ps -Aef | grep wwwrun | grep conf wwwrun
wwwrun 23332 23331 0 20:02 pts/0 00:00:00 bash -c ps -Aef | grep wwwrun | grep conf
wwwrun 23334 23332 0 20:02 pts/0 00:00:00 bash -c ps -Aef | grep wwwrun | grep conf
wwwrun 23335 23332 0 20:02 pts/0 00:00:00 grep conf
Bye Bj
ich wollte mittels exec(ps -Aef | grep ....) bestimmte Prozesse auflisten, jedoch gibt php mit nicht die gleiche Ausgabe, wie sie auf der Shell zu sehen ist.
Die Zeilen werden nicht ganz angezeigt und auf den nicht angezeigtn Teil kann ich auch nicht mehr grep(en).
Was mache ich an dieser Stelle falsch?
Hier noch die Ausgaben, die ich erhalte.
<?
exec ("ps -Aef | grep wwwrun",$prozesse);
foreach($prozesse as $outputline){
echo("$outputline<br>");
}
?>
Ausgabe im Browser:
wwwrun 19024 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 19025 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 19026 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 19027 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 19028 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 2095 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 574 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc
wwwrun 23261 19026 0 19:55 ? 00:00:00 sh -c ps -Aef | grep wwwrun
wwwrun 23262 23261 0 19:55 ? 00:00:00 ps -Aef
wwwrun 23263 23261 0 19:55 ? 00:00:00 grep wwwrun
Ausgabe in der Shell
# su -s /bin/bash -c "ps -Aef | grep wwwrun" wwwrun
wwwrun 19024 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19025 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19026 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19027 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19028 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 2095 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 574 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 23336 17869 0 20:03 pts/0 00:00:00 su -s /bin/bash -c ps -Aef | grep wwwrun wwwrun
wwwrun 23337 23336 0 20:03 pts/0 00:00:00 bash -c ps -Aef | grep wwwrun
wwwrun 23338 23337 0 20:03 pts/0 00:00:00 ps -Aef
wwwrun 23339 23337 0 20:03 pts/0 00:00:00 bash -c ps -Aef | grep wwwrun
<?
exec ("ps -Aef | grep wwwrun | grep conf",$prozesse);
foreach($prozesse as $outputline){
echo("$outputline<br>");
}
?>
Ausgabe im Browser:
wwwrun 23278 23275 0 19:58 ? 00:00:00 grep conf
Ausgabe in der Shell
# su -s /bin/bash -c "ps -Aef | grep wwwrun | grep conf" wwwrun
wwwrun 19024 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19025 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19026 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19027 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 19028 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 2095 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 574 19023 0 Dec07 ? 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 23331 17869 0 20:02 pts/0 00:00:00 su -s /bin/bash -c ps -Aef | grep wwwrun | grep conf wwwrun
wwwrun 23332 23331 0 20:02 pts/0 00:00:00 bash -c ps -Aef | grep wwwrun | grep conf
wwwrun 23334 23332 0 20:02 pts/0 00:00:00 bash -c ps -Aef | grep wwwrun | grep conf
wwwrun 23335 23332 0 20:02 pts/0 00:00:00 grep conf
Bye Bj