Created
May 2, 2013 10:38
-
-
Save zeha/5501415 to your computer and use it in GitHub Desktop.
bt-proximity: Check if your phone (or any other bluetooth device) is in range.
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 | |
# sudoers: | |
# username ALL = NOPASSWD: /usr/bin/hcitool, /bin/mount | |
# crontab: | |
# @reboot ~/Source/dotfiles/tools/bt-proximity | |
# one-time pairing: | |
# bt-device -c F0:XX:XX:XX:XX:XX | |
mkdir -p ~/.local/bt-proximity | |
sudo mount -t tmpfs none ~/.local/bt-proximity | |
STATEFILE=~/.local/bt-proximity/state | |
while true; do | |
sudo hcitool info F0:XX:XX:XX:XX:XX >/dev/null 2>&1 && echo 'present' > $STATEFILE || echo 'absent' > $STATEFILE | |
sleep 60 | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment