Created
July 11, 2014 02:08
-
-
Save jgrevich/c47ba5978088f8567cdf to your computer and use it in GitHub Desktop.
Wifi door bell script for ddwrt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# setup constants | |
CURRENT_LIST_PATH=/tmp/wifi_client_macs_current | |
PREVIOUS_LIST_PATH=/tmp/wifi_client_macs_previous | |
while [ "true" ] | |
do | |
# backup old file if it exists | |
if [ -f $CURRENT_LIST_PATH ]; | |
then | |
cp $CURRENT_LIST_PATH $PREVIOUS_LIST_PATH | |
fi | |
# grab MACs from 2.4Ghz radio | |
wl -i eth1 assoclist | cut -d" " -f2 > $CURRENT_LIST_PATH | |
# grab MACs from 5Ghz radio | |
wl -i eth2 assoclist | cut -d" " -f2 >> $CURRENT_LIST_PATH | |
# do something if desired mac appears in list | |
if grep -Fxq "3C:15:C2:18:F1:8F" $CURRENT_LIST_PATH | |
then | |
echo "Justin is home" | |
else | |
printf "." | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment