Ausgabe von "top" (Linux) mit PHP auslesen?
Mulder
- php
Ich suche nach einem Weg, die Ausgabe des "top"-Befehls in einem PHP-Script auszuwerten.
Mit "top n1" kann man bekanntlich top dazu bringen, nur einmal durchzulaufen und wieder zu beenden.
Jedoch gelingt es mir nicht, diese Ausgabe mit PHP einzulesen.
Habe schon versucht:
Andere vergleichbare Tools (z.B. ColdFusion's "cfstat") funktionieren jedoch prima mit exec() oder passthru().
Hallo Mulder,
Andere vergleichbare Tools (z.B. ColdFusion's "cfstat") funktionieren jedoch prima mit exec() oder passthru().
Du suchst
top -b -n1
Aus dem Manual: (man top)
-b : Batch mode operation
Starts top in 'Batch mode', which could be useful for sending out-
put from top to other programs or to a file. In this mode, top
will not accept input and runs until the iterations limit you've
set with the '-n' command-line option or until killed.
Viele Grüße,
Christian
Du suchst
top -b -n1
Super, 1000 Dank. :o)