#!/bin/sh . /etc/bt-proximity.conf host=`hostname` hciconfig hci0 up cat $1 | while read mac user do if [ "$mac" != "" ] then l2ping -c 2 -t 10 $mac if [ "$?" = "0" ] then mosquitto_pub -h $mqtt_host -p $mqtt_port -u $mqtt_user -P $mqtt_passwd -t $mqtt_topic/$user -m $host logger -t bt-proximity "$mac ($user) detected by $host" fi fi done