Commit e368412d authored by sokai's avatar sokai

variable for automatic detection for wifi-interface

parent 0efd2f90
#!/bin/sh /etc/rc.common
# this version only works with "Backfire"!
# this version only works with OpenWRT "Backfire" and up!
# /etc/init.d/ffp-apdb enable
# DEBUG?
#set -x
#logfile=/tmp/ffp-apdb.log
#exec > $logfile 2>&1
START=99
EXTRA_COMMANDS="update status"
INTERVAL=30 # run cron every x minutes (max 59?)
INTERVAL=55 # run cron every x minutes (max 59?)
URL='http://freifunk-potsdam.de/apdb/' # with / at the end!
SCRIPTVERSION='120801-bf3'
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
HOSTNAME=$(cat /etc/config/system| awk '/hostname/ {print $3}'|sed 's/ /%20/g')
IP=$(ifconfig wlan0|grep 'inet addr'|awk '{print $2}'| sed 's/addr://'|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')
LONGITUDE=$(grep 'longitude' /etc/config/system| awk '{$1=$2="";print}'|sed 's/ /%20/g')
......@@ -22,7 +29,7 @@ UPTIME=$(cat /proc/uptime|sed 's/ /%20/g')
FIRMWARE=$(cat /etc/openwrt_version|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 wlan0 station dump|grep -c Station)
CLIENTS=$(iw dev ${WIF} station dump|grep -c Station)
start() {
update="*/$INTERVAL * * * * /etc/init.d/ffp-apdb update # every $INTERVAL minutes"
......@@ -110,4 +117,4 @@ update() {
# everything looks fine
rm $PID_FILE
}
\ No newline at end of file
}
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