Howdy, Stranger!

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

Categories

System-Command in perl

SouldrinkerSouldrinker Member Posts: 143
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 :)
  • SouldrinkerSouldrinker Member Posts: 143
    yeah, as in php :) thx

  • Andre YoungAndre Young USAMember Posts: 0

    _______ { http://forcoder.org } free ebooks and video tutorials about // Assembly Go Swift MATLAB C++ PL/SQL Ruby PHP Visual Basic Java C# JavaScript C R Delphi Visual Basic .NET Scratch Perl Objective-C Python FoxPro F# Crystal Fortran D Awk Clojure Apex Prolog VBScript Logo COBOL Scheme Dart SAS Bash Lisp Lua Transact-SQL Kotlin Alice Erlang LabVIEW Rust ML ABAP Hack Ada Julia Scala // ______________

Sign In or Register to comment.