diff --git a/root_file_system/default/etc/clients.sh b/root_file_system/default/etc/clients.sh new file mode 100755 index 0000000..e7a5b46 --- /dev/null +++ b/root_file_system/default/etc/clients.sh @@ -0,0 +1,15 @@ +MESH_INTERFACE="br-mesh" +CLIENT_INTERFACES="wlan0" + +#CLIENTS +SEDDEV=`brctl showstp $MESH_INTERFACE | egrep '\([0-9]\)' | sed -e "s/(//;s/)//" | awk '{ print "s/^ "$2"/"$1"/;" }'` + +for entry in $CLIENT_INTERFACES; do + CLIENT_MACS=$CLIENT_MACS`brctl showmacs $MESH_INTERFACE | sed -e "$SEDDEV" | awk '{if ($3 != "yes" && $1 == "'"$entry"'") print $2}'`" " +done + +i=0 +for client in $CLIENT_MACS; do + i=`expr $i + 1` #Zähler um eins erhöhen +done +echo $i diff --git a/root_file_system/default/etc/clients_event.sh b/root_file_system/default/etc/clients_event.sh new file mode 100755 index 0000000..6936dc4 --- /dev/null +++ b/root_file_system/default/etc/clients_event.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +while read LINE +do + if [ "`echo $LINE | grep 'wlan0:'`" != "" ]; then + wget -q -O - http://status.kreativitaet-trifft-technik.de/update/ff\?client_associated=`date +%s`\&clients_count=`/etc/clients.sh` & sleep 3; kill $! + #echo http://status.kreativitaet-trifft-technik.de/update/ff\?client_associated=`date +%s`\&clients_count=`/etc/clients.sh` & sleep 3; kill $! + + fi + #echo `echo $LINE | grep 'wlan0:' | awk '{ print $4 }'` >> /var/log/clients_event.log +done + + diff --git a/root_file_system/default/etc/rc.local b/root_file_system/default/etc/rc.local index d3748d2..8491c27 100755 --- a/root_file_system/default/etc/rc.local +++ b/root_file_system/default/etc/rc.local @@ -47,4 +47,7 @@ httpd -h /tmp/crawldata sh /etc/configurator.sh +#do something if a client associates +#iw event -f | /etc/clients_event.sh & + exit 0