mapid/notification.sh

39 lines
655 B
Bash
Raw Normal View History

#!/usr/bin/env bash
source "$(dirname $0)/.env"
#LINE1='Backup finished!'
#LINE2=''
[ -t /dev/stdin ] && printf "Line 1> "; read LINE1
[ -t /dev/stdin ] && printf "Line 2> "; read LINE2
LED_BLINK=".5s"
#DISPLAY_DURATION="4s"
DISPLAY_DURATION="10s"
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"