home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
c't freeware shareware 1997
/
CT_SW_97.ISO
/
mac
/
Software
/
entwickl
/
win95
/
pw32i306.exe
/
eg
/
myrup
< prev
next >
Wrap
Text File
|
1994-10-18
|
920b
|
30 lines
#!/usr/bin/perl
# $RCSfile: myrup,v $$Revision: 4.1 $$Date: 92/08/07 17:20:26 $
# This was a customization of ruptime requested by someone here who wanted
# to be able to find the least loaded machine easily. It uses the
# /etc/ghosts file that's defined for gsh and gcp to prune down the
# number of entries to those hosts we have administrative control over.
print "node load (u)\n------- --------\n";
open(ghosts,'/etc/ghosts') || die "Can't open /etc/ghosts: $!";
line: while (<ghosts>) {
next line if /^#/;
next line if /^$/;
next line if /=/;
($host) = split;
$wanted{$host} = 1;
}
open(ruptime,'ruptime|') || die "Can't run ruptime: $!";
open(sort,'|sort +1n');
while (<ruptime>) {
($host,$upness,$foo,$users,$foo,$foo,$load) = split(/[\s,]+/);
if ($wanted{$host} && $upness eq 'up') {
printf sort "%s\t%s (%d)\n", $host, $load, $users;
}
}