[IMP] point_of_sale: migrate the script that sets the rpi leds
When the server is answering HTTP requests, the status led (green one) of the Raspberry Pi will turn on. Contrary to the previous script this will not exit and keep running every 5 seconds. This way we can easily troubleshoot connection issues (if led is on and we can't connect it's a network issue, otherwise it's an issue with Odoo).
This commit is contained in:
parent
86762ef30f
commit
54697a551c
|
@ -20,4 +20,6 @@ fi
|
|||
mkdir -p /var/run/odoo
|
||||
chown pi:pi /var/run/odoo
|
||||
|
||||
/home/pi/led_status.sh &
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set_brightness() {
|
||||
echo "${1}" > /sys/class/leds/led0/brightness
|
||||
}
|
||||
|
||||
check_status_loop() {
|
||||
while true ; do
|
||||
if wget --quiet localhost:8069/hw_proxy/hello -O /dev/null ; then
|
||||
set_brightness 255
|
||||
else
|
||||
set_brightness 0
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
|
||||
echo none > /sys/class/leds/led0/trigger
|
||||
check_status_loop
|
Loading…
Reference in New Issue