Skip to content

Instantly share code, notes, and snippets.

@jgrevich
Created July 11, 2014 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgrevich/c47ba5978088f8567cdf to your computer and use it in GitHub Desktop.
Save jgrevich/c47ba5978088f8567cdf to your computer and use it in GitHub Desktop.
Wifi door bell script for ddwrt
#!/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