Commit 00335359 authored by sokai's avatar sokai

urgent fix for WIF (only show interfaces starting with wlan) and some hints...

urgent fix for WIF (only show interfaces starting with wlan) and some hints for porting the script to uci
parent a36fa10d
#!/bin/sh /etc/rc.common
# this version only works with OpenWRT "Backfire" and up!
# this version only works with OpenWrt Backfire and up!
# /etc/init.d/ffp-apdb enable
# DEBUG?
......@@ -14,22 +14,29 @@ INTERVAL=55 # run cron every x minutes (max 59?)
URL='http://freifunk-potsdam.de/apdb/' # with / at the end!
SCRIPTVERSION='160119-bf'
WIF=$(ifconfig | awk '/10\.22\.[0-9]{1,3}\.[0-9]{1,3}/ {print $1}' RS="\n\n") # http://stackoverflow.com/a/18344694/338049
WIF=$(ifconfig | awk '/10\.22\.[0-9]{1,3}\.[0-9]{1,3}/ {print $1}' RS="\n\n" | grep wlan) # http://stackoverflow.com/a/18344694/338049
#WIFI= uci show = [email protected][0].ifname=wlan0-adhoc-2
HOSTNAME=$(cat /etc/config/system| awk '/hostname/ {print $3}'|sed 's/ /%20/g')
#HOSTNAME=$(uci show system|grep -i hostname|cut -d '=' -f2|sed 's/ /%20/g')
IP=$(ifconfig ${WIF}|grep 'inet addr'|awk '{print $2}'| sed 's/addr://'|sed 's/ /%20/g')
GWIP=$(ip route | awk '/default via/ {print $3}') # awk nicht installiert :(
LATITUDE=$(grep 'latitude' /etc/config/system| awk '{$1=$2="";print}'|sed 's/ /%20/g')
#LATITUDE=$(uci show system|grep -i latitude|cut -d '=' -f2|sed 's/ /%20/g')
LONGITUDE=$(grep 'longitude' /etc/config/system| awk '{$1=$2="";print}'|sed 's/ /%20/g')
#LONGITUDE=$(uci show system|grep -i longitude|cut -d '=' -f2|sed 's/ /%20/g')
GEOLOC="${LATITUDE};${LONGITUDE}"
LOCATION=$(grep 'location' /etc/config/system|awk '{$1=$2="";print}'|sed 's/ /%20/g')
#LOCATION=$(uci show system.system.location|sed 's/system.system.location=//'|sed 's/ /%20/g')
#LOCATION=$(uci show system|grep -i location|cut -d '=' -f2|sed 's/ /%20/g')
CONTACT=$(grep 'mail' /etc/config/freifunk|awk '{$1=$2="";print}'|sed 's/ /%20/g'|sed 's/#/%23/g')
#CONTACT=$(uci show |grep -i 'freifunk.contact.mail' |cut -d '=' -f2|sed 's/ /%20/g')
UPTIME=$(cat /proc/uptime|cut -d ' ' -f2|sed 's/ /%20/g')
FIRMWARE=$(cat /etc/openwrt_version|sed 's/ /%20/g')
#FIRMWARE=$(uci show system|grep -i version|cut -d '=' -f2|sed 's/ /%20/g')
MACHINE=$(grep 'machine' /proc/cpuinfo|awk '{$1=$2=""; print}'| sed 's/\ \ //'|sed 's/ /%20/g')
SYSTEMTYPE=$(grep 'system type' /proc/cpuinfo|awk '{$1=$2=""; print}'| sed 's/ : //'|sed 's/ /%20/g')
CLIENTS=$(iw dev ${WIF} station dump|grep -c Station)
#CLIENTS=$(cat /tmp/dhcp.leases|wc -l)
start() {
update="*/$INTERVAL * * * * /etc/init.d/ffp-apdb update # every $INTERVAL minutes"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment