Code-Schnipsel
Version vom 8. Oktober 2006, 00:46 Uhr von Fries43 (Diskussion | Beiträge) (→Netzkarte als .dot-Datei ausgeben mit olsrd-plaintext-plugin)
Netzkarte als .dot-Datei ausgeben mit olsrd-plaintext-plugin
- speichern als /www/cgi-bin-map
- beim aufruf wird direkt die datei heruntergeladen, danach:
- neato -Goverlap=scale -Gsplines=true -Gstart=3 -v -Tpng -o karte.png karte.dot
#!/bin/sh D=$(date|sed -e's/[:T-]/ /g'|while read t m t h mi r r r y;do echo $y$m$t-$h"uhr"$mi;done) F="netzkarte-("$(nvram get wl0_ssid)")-"$D".dot" echo "Content-type: application/octet-stream" echo "Content-Disposition: attachment; filename=\"$F\"" echo -e "\ngraph g {" awk '/10.63./ { IP=$1 gsub(/\./,"A",$1) gsub(/[^a-zA-Z0-9. ]/,"",$2) gsub(/.olsr/,"",$2) print "A"$1"[label=\""$2"\\n("IP")\"];"}' /etc/hosts wget -O - http://127.0.0.1:2006|awk '{ if(s==1){ if($0=="")exit if($5!="0.00"&&$5<11){ if($5<11)arg="dotted" if($5<7)arg="dashed" if($5<4)arg="normal" if($5<2)arg="bold" style="[style="arg"];" if(arg=="normal")style=";" gsub(/\./,"A",$1) gsub(/\./,"A",$2) print "A"$1" -- A"$2,style }} if($2=="Topology")s=1}END{print "}"}'