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