iopsys-feed/files/etc/init.d/btle_alarm
2015-04-01 10:41:04 +02:00

29 lines
606 B
Bash
Executable file

#!/bin/sh /etc/rc.common
#
# Copyright (C) 2009 OpenWrt.org
#
START=99
start() {
for i in down reset up;do
hciconfig hci0 $i
done
mac=`uci get btle_alarm.Device.mac`
if [ $? -eq 0 ];then
hcitool lewladd $mac
else
hcitool lewladd D0:39:72:B6:43:8A
hcitool lewladd D0:39:72:B6:18:AA
fi
sleep 1
/sbin/btle_alarm &> /dev/null &
echo $! > /tmp/btle_alarm.pid
}
stop() {
hciconfig hci0 down
kill -9 `cat /tmp/btle_alarm.pid`
rm /tmp/btle_alarm.pid
sleep 1
}