Revision 10724,
897 bytes
checked in by ghudson, 27 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r10723,
which included commits to RCS files with non-trunk default branches.
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | # $RCSfile: myrup,v $$Revision: 1.1.1.2 $$Date: 1997-11-13 01:47:45 $ |
---|
4 | |
---|
5 | # This was a customization of ruptime requested by someone here who wanted |
---|
6 | # to be able to find the least loaded machine easily. It uses the |
---|
7 | # /etc/ghosts file that's defined for gsh and gcp to prune down the |
---|
8 | # number of entries to those hosts we have administrative control over. |
---|
9 | |
---|
10 | print "node load (u)\n------- --------\n"; |
---|
11 | |
---|
12 | open(ghosts,'/etc/ghosts') || die "Can't open /etc/ghosts: $!"; |
---|
13 | line: while (<ghosts>) { |
---|
14 | next line if /^#/; |
---|
15 | next line if /^$/; |
---|
16 | next line if /=/; |
---|
17 | ($host) = split; |
---|
18 | $wanted{$host} = 1; |
---|
19 | } |
---|
20 | |
---|
21 | open(ruptime,'ruptime|') || die "Can't run ruptime: $!"; |
---|
22 | open(sort,'|sort +1n'); |
---|
23 | |
---|
24 | while (<ruptime>) { |
---|
25 | ($host,$upness,$foo,$users,$foo,$foo,$load) = split(/[\s,]+/); |
---|
26 | if ($wanted{$host} && $upness eq 'up') { |
---|
27 | printf sort "%s\t%s (%d)\n", $host, $load, $users; |
---|
28 | } |
---|
29 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.