Talk:Script examples

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 16:36, 10 September 2008 (edit)
Maven (Talk | contribs)
(Small change to wireless scanner script for v24)
← Previous diff
Revision as of 16:44, 10 September 2008 (edit) (undo)
Maven (Talk | contribs)
(Small change to wireless scanner script for v24)
Next diff →
Line 7: Line 7:
I was getting bleed onto the second line using the provided (and very functional) script. I modified the code to shorten the length of the signal strength meter to fit nicely on one line I was getting bleed onto the second line using the provided (and very functional) script. I modified the code to shorten the length of the signal strength meter to fit nicely on one line
 +Change this:
 + fmt = "%s%-15s %s%0"sigstrength"d "reset erase2end "\n %s %s%-4d %s%-4d %s%-4d %s%2s " reset erase2end "\n" erase2end "\n";
-----+To This:
-#!/bin/sh+
- +
-awk -F"[][]" '+
-BEGIN{+
- IGNORECASE = 1;+
- command = "site_survey 2>&1";+
- red = "\x1b[31m"; green = "\x1b[32m";+
- greenback="\x1b[42m"; yellow = "\x1b[33m";+
- cyan = "\x1b[36m"; blue = "\x1b[34m";+
- blueback = "\x1b[44m"; white = "\x1b[37m";+
- whiteback = "\x1b[47m"; reset = "\x1b[0m";+
- underscore = "\x1b[4m"; clear = "\x1b[2J";+
- home = "\x1b[0;0H"; erase2end = "\x1b[K";+
- cName = white; cSignal = green;+
- cNoise = red; cCaps = green;+
- cStrengthLow = blue blueback; cChannel = green; +
- cStrengthMed = white whiteback;+
- cStrengthHi = green greenback;+
- cStrengthAged = red;+
- +
- print clear;+
- for(;;)+
- {+
- while (command|getline)+
- { +
- if ($22 == "") continue;+
- bssid=$6;+
- name[bssid] = $4;+
- rssi[bssid] = $10;+
- noise[bssid]= $12;+
- channel[bssid] = $8;+
- caps[bssid] = $22;+
- age[bssid] = 1;+
- }+
- close(command);+
- printf home;+
- ln = 0;+
- print white " Name BSSID Signal Noise Channel Type";+
- for (x in name)+
- { +
- #arbitrary strength calc through trial and error... modify as you wish:+
- sigstrength = ((rssi[x] - noise[x])*1.5) + ((rssi[x] +90)*1.5);+
- if (sigstrength <1) sigstrength=0;+
- cStrength = cStrengthLow;+
- if(sigstrength>4) cStrength = cStrengthMed;+
- if(sigstrength>7) cStrength = cStrengthHi;+
- if(age[x]=0) cStrength = cStrengthAged; +
fmt = "%s%-15s %s%0"sigstrength/3"d "reset erase2end "\n %s %s%-4d %s%-4d %s%-4d %s%2s " reset erase2end "\n" erase2end "\n"; fmt = "%s%-15s %s%0"sigstrength/3"d "reset erase2end "\n %s %s%-4d %s%-4d %s%-4d %s%2s " reset erase2end "\n" erase2end "\n";
- printf fmt, cName,name[x],cStrength,0,x,cSignal,rssi[x],cNoise,noise[x],cChannel, channel[x],cCaps,caps[x];  
- rssi[x] = "-100 xxxx"; 
- ln++;  
- }  
- if (ln ==0)  
- print red "No Results - Do you have survey capability? \nThis program depends on site_survey to run. Hit ctrl-c to stop."; 
- 
- print erase2end; 
- } 
-} 
-' 

Revision as of 16:44, 10 September 2008

DNS Setup

With the freedns.afraid.org, can't that be done using Inadyn? Alex 15:42, 3 Sep 2006 (CEST)

Small change to wireless scanner script for v24

I was getting bleed onto the second line using the provided (and very functional) script. I modified the code to shorten the length of the signal strength meter to fit nicely on one line

Change this:

       fmt = "%s%-15s %s%0"sigstrength"d "reset erase2end "\n    %s  %s%-4d %s%-4d %s%-4d %s%2s "  reset erase2end "\n" erase2end "\n";

To This:

       fmt = "%s%-15s %s%0"sigstrength/3"d "reset erase2end "\n    %s  %s%-4d %s%-4d %s%-4d %s%2s "  reset erase2end "\n" erase2end "\n";