System-Command in perl

hey there,

need some help on perl...

as you all may know there is some "system" command to fork system-commands under *x systems. Now I want to write some script on my server that checks if some service is alive or not, and in case that one is not notifys me with email and trys to restart this service.

I do so with the *x command "rc[service] status", If I try to fork system("rcapache status"); for example it does very well, but now the problem is how to check what return value this forked system-command gave to me.

Has anyone some Idea about retreiving the whole return-statement of some forked system-command?

regards

souldrinker

Comments

  • system (i think) returns the commands return value. So to get the value a simple

    [code]
    my $val = system("command");
    [/code]

    Will do it. Hope you get the idea :)
  • yeah, as in php :) thx

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion