Skrypt startowy, mozna dopisac do /etc/rc.conf DAEMONS, wyswietla transfer na 7 i 8 konsoli:
/etc/rc.d/tc-viewer
#!/bin/sh
. /etc/rc.conf
. /etc/rc.d/functions
# nalezy wpisac wlasne interfejsy
iface1=eth0
iface2=eth1
tcv=`which tc-viewer 2>/dev/null`
if [ $? -gt 0 ]; then
stat_busy "Start tc-viewer brak programu tc-viewer"
stat_fail
exit 1
fi
start() {
RUNNING=`cat /var/run/tc-viewer 2>/dev/null`
stat_busy "Start tc-viewer"
if [ -z "$RUNNING" ]; then
# mozna dopisac wlasne opcje/plik konfiguracyjny
$tcv --iface=$iface1 --colors --unit=kbit >/dev/tty7 &
$tcv --iface=$iface2 --colors --unit=kbit >/dev/tty8 &
echo "running" > /var/run/tc-viewer
add_daemon tc-viewer
stat_done
else
stat_fail
fi
}
stop() {
RUNNING=`cat /var/run/tc-viewer 2>/dev/null`
stat_busy "Zatrzymanie tc-viewer"
if [ ! -z "$RUNNING" ]; then
kill -9 `pidof -o %PPID -x tc-viewer`
rm /var/run/tc-viewer
rm_daemon tc-viewer
stat_done
else
stat_fail
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 1
start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0
Drobne poprawki w kodzie tc-viewer
linia 195 dopisac ",$iface," co wyswietli nam nazwe interfejsu jaki badamy:
print "\n\n\tMode: ", $hfsc eq "0" ? "HTB" : "HFSC" ," ",$iface," ^C to QUIT$colors......
linia 246 wykasowac (%s%3dpps%s) bo sie nie miesci na ekranie i zawija linie co powoduje balagan
I jesze jedno restart regul powoduje zatrzymanie viewera.
_________________
Nie jestem NEKROMANTĄ, nie wróżę z flaków!
Alkohol pity z umiarem nie szkodzi nawet w największych ilościach!
Przeczytaj nim zapytasz
