notification.sh: Simple script to blink LED and show an notification

This commit is contained in:
Malte Bublitz 2023-10-27 00:20:05 +02:00
parent c03d2e8fae
commit 0db20ca4db
Signed by: malte70
GPG key ID: 605DA5C729F9C184

36
notification.sh Executable file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env bash
source "$(dirname $0)/.env"
#FIFO=/tmp/mapid
LINE1='Backup finished!'
LINE2=''
LED_BLINK=".5s"
DISPLAY_DURATION="4s"
if [[ ! -e $FIFO ]]; then
echo "Error: $FIFO does not exist." >&2
exit 2
fi
echo >$FIFO "CLS"
if [[ -n $LINE1 ]]; then
echo >$FIFO "LINE 1"
echo >$FIFO "ECHO $LINE1"
fi
if [[ -n $LINE2 ]]; then
echo >$FIFO "LINE 2"
echo >$FIFO "ECHO $LINE2"
fi
echo >$FIFO "LCDON"
echo >$FIFO "ON"
gsleep $LED_BLINK
echo >$FIFO "OFF"
gsleep $DISPLAY_DURATION
echo >$FIFO "LCDOFF"