File: example.sh

package info (click to toggle)
traffic-vis 0.34-3
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 356 kB
  • ctags: 436
  • sloc: ansic: 4,029; makefile: 144; perl: 82; sh: 25
file content (32 lines) | stat: -rw-r--r-- 764 bytes parent folder | download | duplicates (3)
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
31
32
#!/bin/sh

usage() {
	echo ""
	echo "$0 <destination dir> <summary> "
	echo "<destination dir> the dest to store files"
	echo "<summary> the summary file of traffic-collector"
	echo ""
	exit 1
}

if [ -z "$1" -o ! -d "$1" ] ; then 
	usage;
fi

killall -USR1 traffic-collector
if [ $? -ne 0 ] ; then 
	exit 2
fi

if [ -z "$2" -o ! -f "$2" ] ; then
	COLLECTOR=/var/run/traffic-collector
else
	COLLECTOR="$2"
fi


/usr/sbin/traffic-sort -Hb -Pb -L60 < $COLLECTOR > "$1/report-sorted.tv"
/usr/sbin/traffic-resolve < "$1/report-sorted.tv" > "$1/report-resolved.tv"
/usr/sbin/traffic-tohtml < "$1/report-resolved.tv" > "$1/report.html"
/usr/sbin/traffic-tops < "$1/report-resolved.tv" > "$1/report.ps"
/usr/sbin/traffic-togif < "$1/report-resolved.tv" > "$1/report.gif"