Frank Schönmann: (QUASI ~) Serverauslastung

Beitrag lesen

hi!

In Perl kann man solche Kommandos mit der Funktion system() aus
einem Script heraus ausfuehren. Beispiel:
my $Ergebnis = system("vmstat");
Und dann musst dein Script halt $Ergebnis z.B. mit Hilfe
regulaerer Ausdruecke auseinanderdroeseln und aus den ermittelten
Werten seine Reaktionen ableiten.

perldoc -f system:
   [...]
   The return value is the exit status of the program as returned
   by the "wait" call. To get the actual exit value divide by 256.
   See also the exec entry elsewhere in this document. This is
   *not* what you want to use to capture the output from a command,
   for that you should use merely backticks or "qx//", as described
   in the section on "STRING" in the perlop manpage. Return value
   of -1 indicates a failure to start the program (inspect $! for
   the reason).
   [...]

Besonders wichtig in diesem Zusammenhang erscheint mit die fett-
gedruckte Stellte mit dem *not*... ;)

Also, wie es dort schon steht: Backticks oder qx// verwenden!

bye, Frank!