Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc Change the default behavior of the netstat run during ch...



details:   https://anonhg.NetBSD.org/src/rev/143cef8d96ed
branches:  trunk
changeset: 556132:143cef8d96ed
user:      perry <perry%NetBSD.org@localhost>
date:      Sun Dec 07 22:22:15 2003 +0000

description:
Change the default behavior of the netstat run during check_network to
print a summary rather than the full (and not usually desired) output
of netstat -inv. The old behavior can be returned by simply setting
full_netstat to YES in daily.conf.

Original idea by me, cleaner and more correct execution via small awk
script from Greg Woods.

diffstat:

 etc/daily |  22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r ec526fe8f21f -r 143cef8d96ed etc/daily
--- a/etc/daily Sun Dec 07 22:17:54 2003 +0000
+++ b/etc/daily Sun Dec 07 22:22:15 2003 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#      $NetBSD: daily,v 1.53 2003/12/07 16:55:04 perry Exp $
+#      $NetBSD: daily,v 1.54 2003/12/07 22:22:15 perry Exp $
 #      @(#)daily       8.2 (Berkeley) 1/25/94
 #
 
@@ -201,7 +201,25 @@
 if checkyesno check_network; then
        echo ""
        echo "network:"
-       netstat -inv
+       if checkyesno full_netstat; then
+               netstat -inv
+       else
+               netstat -in | awk 'BEGIN {
+                       ifs[""] = 0;
+               }
+               /^[^\*]* / {
+                       if (NR == 1) {
+                               printf("%-8s %10s %6s %10s %6s %6s\n",
+                                 $1, $(NF-4), $(NF-3), $(NF-2), $(NF-1), $NF);
+                               next;
+                       }
+                       if (!($1 in ifs)) {
+                               printf("%-8s %10d %6d %10d %6d %6d\n",
+                                 $1, $(NF-4), $(NF-3), $(NF-2), $(NF-1), $NF);
+                               ifs[$1] = 1;
+                       }
+               }'
+       fi
        echo ""
        t=/var/rwho/*
        if [ "$t" != '/var/rwho/*' ]; then



Home | Main Index | Thread Index | Old Index