On 21 Jun 2006 at 11:28, Smith, Derek wrote:
> From: Smith, Derek
> Sent: Wednesday, June 21, 2006 11:19 AM
> To: [email protected]
> Subject: uninitialized value error
>
>
> I am getting the following error yet the script is doing what I need it to do
> restart a process:
>
> Use of uninitialized value at /usr/local/admin/named_monit.pl line 71 (#1)
>
> (W) An undefined value was used as if it were already defined. It was
> interpreted as a "" or a 0, but maybe it was a mistake. To suppress this
> warning assign an initial value to your variables.
>
> ps: wrong PID number -o
> ps: Unknown option (vsz).
> Did not close FH ps at /usr/local/admin/named_monit.pl line 86.
> Did not close FH pso at /usr/local/admin/named_monit.pl line 87.
>
>
>
> Here is my code as attached, but please excuse the Perl version..... 5.005_03
> Thank you
> Derek
I am no expert but the error doesn't necessarily mean the program fails. It
means $arry[0] is
uninitialized which is probably not what was intended. I suspect that the pipe
on "ps -ef|grep
...named" is taking in some extra lines. The fact that ps is complaining that
there was no PID
seems to indicate that what is being passed to ps is not a process id number
but something else.
The script may work but I wonder if the part that is looking for a virtual
memory size gt 63000
would do what it was meant to.
To debug it you want to see what going into @arry so maybe something like
[un-tested] this will
show you if your getting what from the pipe.
for (;<PS>;) {
print SDTERR "PS=$_\n";
push @arry, (split)[1];
}
I will obviously bow before the others in this group when the point out the
errors of my ways.
Thanx.
Dp.
Dermot Paikkos
Network Administrator @ Science Photo Library
Phone: 0207 432 1100
Fax: 0207 286 8668
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>