Hi guys,
I want my router to send a list of connected wifi clients via UDP message to my home automatization.
These three lines do exatly what I want:
iwinfo wlan0 assoclist > assoclist.txt
iwinfo wlan1 assoclist >> assoclist.txt
nc -u -w1 -c 192.168.1.8 5678 < assoclist.txt
I would like to send the file every other second so my idea is something like this:
#!/bin/sh
while :
do
iwinfo wlan0 assoclist > assoclist.txt
iwinfo wlan1 assoclist >> assoclist.txt
nc -u -w1 -c 192.168.1.8 5678 < assoclist.txt
sleep 1
done
Now we come to the point where I’m struggling. From what I read in the FAQ I can ether create an init script or an procd init script. Which one is the better choice in my case?
Assuming it’s init script would this work:
#!/bin/sh /etc/rc.common
START=50
start() {
while :
do
iwinfo wlan0 assoclist > assoclist.txt
iwinfo wlan1 assoclist >> assoclist.txt
nc -u -w1 -c 192.168.1.8 5678 < assoclist.txt
sleep 1
done
}
Further Questions:
What do I need to do to run the start the script automatically after a reboot?
Will this place significant load on my router (do I need to lengthen the pause)?
(Last edited by Swallowtail on 4 Jan 2018, 13:32)