Try 5 times before failing and log details
This commit is contained in:
parent
73dd52440c
commit
2860cd8800
26
keyboard
26
keyboard
@ -1,10 +1,22 @@
|
|||||||
#$/bin/bash
|
#$/bin/bash
|
||||||
bluetoothctl connect F4:73:35:67:32:0A
|
code=0
|
||||||
code=$?
|
let counter=1
|
||||||
dt=$(date +'%d/%m/%y-%H.%M.%S')
|
dt=$(date +'%d/%m/%y-%H.%M.%S')
|
||||||
if [ $code -eq 0 ]; then
|
|
||||||
echo "[$dt] Connected to keyboard" > /home/ferit/navi.log
|
function connect() {
|
||||||
else
|
bluetoothctl connect F4:73:35:67:32:0A
|
||||||
echo "[$dt] Couldn't connect to keyboard" > /home/ferit/navi.log
|
code=$?
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
while (( counter <= 5 ))
|
||||||
|
do
|
||||||
|
connect
|
||||||
|
if [ $code -eq 0 ]; then
|
||||||
|
echo "[$dt] Connected to keyboard" >> /home/ferit/navi.log
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "[$dt] Couldn't connect to keyboard ($counter/5)" >> /home/ferit/navi.log
|
||||||
|
fi
|
||||||
|
((counter++))
|
||||||
|
done
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user