File: dnetinfo.sh

package info (click to toggle)
dnprogs 2.43.2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,936 kB
  • ctags: 3,872
  • sloc: ansic: 24,686; cpp: 10,608; makefile: 769; sh: 551; awk: 13
file content (30 lines) | stat: -rwxr-xr-x 651 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
#
# Quick & dirty shell script to query dnetd for the 
# node routing status.
#
# If that's not available then show the current neighbour table.
#

# These bizarre awk-isms are to cope with different versions of awk, sigh

show_all()
{
  awk '{ if (ARGIND == 1 || FILENAME == "/etc/decnet.conf") node[$2] = $4;\
       if (ARGIND == 2 || FILENAME == "/proc/net/decnet_neigh") printf "%-10s %-12s %s\n", $1, node[$1], $6}' \
          /etc/decnet.conf /proc/net/decnet_neigh | sort -g
}

if [ "$1" = "-n" ]
then
  show_all
  exit 0
fi

killall -USR1 dnroute 2>/dev/null
if [ "$?" = "0" ]
then
  cat /var/run/dnroute.status
else
  show_all
fi