I have the following bit of code I have written: @temparray = `"$lcf_tools\\ntprocinfo |$lcf_tools\\grep $process"`; foreach $temp (@temparray){ ($pid,$name) = split(" ", $temp); print LOGFILE "The process named $name is running\n"; if ($name == ""){ print LOGFILE "The process named $process is not running\n"; print "WinProcess-$severity-$process-$group"; } } }
I am trying to monitor processes using this script, and if i run an ntprocinfo |grep asdfkljasdfjk and it returns nothing Ineed to print this to standard out. How can i logically check this. The return from ntprocinfo should return nothing if the process is not running and if it is running it will return code. I can get I get the following logic to work? I basically need to do a print if nothing is returned, this is where I am lost. if ($name == ""){ print LOGFILE "The process named $process is not running\n"; print "WinProcess-$severity-$process-$group"; Anthony J Segelhorst Enterprise Systems Management Team Phone: 937-495-1876 Email: [EMAIL PROTECTED] ________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs SkyScan service._______________________________________________________________ Note: Please update your email address for this user to reflect the new MeadWestvaco Corporation. MeadWestvaco employee email addresses are in the format of [EMAIL PROTECTED] This electronic message contains information from MeadWestvaco Corporation or subsidiary companies, which may be confidential, privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named. If you are not an intended recipient, be aware that any review, disclosure, copying, distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error, please notify MeadWestvaco immediately at [EMAIL PROTECTED] _______________________________________________________________________