Well, my first thought would be, wouldn't that return the exit code
from the command being run, and not the output?

Second thought would be, even if that gave the output , wouldn't it
give the direct output of the command being executed at that time
(before it hits the sleep command)

It sounds like what you're needing to do is to open a file, and read the file.

But I could be way off on that.

Jarrod

On Wed, Aug 19, 2009 at 7:59 AM, Raheel Hassan<[email protected]> wrote:
> ---------- Forwarded message ----------
> From: Raheel Hassan <[email protected]>
> Date: Wed, Aug 19, 2009 at 2:48 PM
> Subject: This code is not giving the required output.
> To: [email protected]
>
>
> Hello,
>
> I have problems in executing the under given code. I need to restart my
> database, apache etc services using on ubuntu machine. for that i have
> written thsi code, but the result of the command is not saving in the file ,
> any suggestions please.
>
>
> my $result = 'service mysql start 2>>/var/log/comm.log';
> sleep 10;
> if($result =~ /OK/)
>      {
>     print "OK";
>         }
>  else
>        {
>        print "NOK\n";
>
>
>
> Regards,
> Raheel.
>

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to