On Monday, July 1, 2002, at 02:08 , Deb wrote:
[..]
> I'm not sure what approach to take to alleviate the cascading failure.
> I'd prefer to just abort the df, log the error, and complete the rest
> of the script. Short of totally re-writing the script (it's not mine,
> to begin with), I would like to modify it. It's a simple system command
> being used:
>
> system ("/usr/sbin/df -kl");
[..]
well I think that you are rushing at the need to 'rewrite' the
script - as ander's has pointed out - with some fine examples -
of ways to go.
I shall assume that this is a 'solaris box' - since your df is
in /usr/sbin - as is the solarisism - hence the problem in part
is that it is walking through /etc/mnttab trying to do some basic
resolution of what file systems are 'local' - and is getting wedgied
in the usual places that this will get wedgied even IF the command
is executed at the command line - when things are in the hang out
state because of NFS being wonky....
You will notice that 'df' is NOT one of the PPT players.
cf
http://www.perl.com/language/ppt/what.html
so a part of what needs to be addressed is why this is just
having a 'system(...)' there to blandly generate data? eg:
vladimir: 65:] perl -e 'system ("/usr/sbin/df -kl");'
Filesystem kbytes used avail capacity Mounted on
/proc 0 0 0 0% /proc
/dev/dsk/c0t0d0s0 6192617 765847 5364844 13% /
fd 0 0 0 0% /dev/fd
swap 2268896 1528 2267368 1% /tmp
vladimir: 66:]
that is rather 'lame' to begin with... in the main because
you get to view the two 'psuedo' file systems "/proc" and "/dev/fd"
and I am hard pressed as to why those are 'relevant' to "monitor"
this way....
One can sometimes avoid the "hang" by targetting expressly the
actual file systems by name with something like:
#
# generic maintenance note - Here is where we Put the
# types of FS's to check for - that we would want to parse for
#
my $fstype ='ufs|tmpfs';
my $vfstab = "/tmp/drieux/vfstab" ; # in lieu of "/etc/vfstab"
my @FS;
open(FSTAB, $vfstab) || die "unable to open VFSTAB: $!\n";
while(<FSTAB>) {
push(@FS, $1)
if (/^(?:\/dev\S+|swap)+ # only lines that start with
# the
\/dev* or swap
\s+\S+\s+ # skip over the raw
device
(\S+)\s+ # collect the Mount
Name
(?:$fstype)+ # if it matches our $fstype
/ox) ;
} }
print "FS: $_ \n" for @FS;
system("df -lk @FS");
I of course would stuff that in a 'sub' so that you can
just do the 'line out' at the silly bit where you run
the 'system' call....
cf:
http://www.wetware.com/drieux/pbl/Sys/Admin/vfstabParser.txt
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]