don't send empty emails

This commit is contained in:
mischa 2019-11-07 00:36:13 +01:00
parent 440a9b96ee
commit 8742d1e32a
1 changed files with 5 additions and 1 deletions

View File

@ -5,4 +5,8 @@ PATH=$PATH:/usr/local/bin
# Add the following to crontab:
# @daily /<path-to-your-script>/wrapper-sensors-battery.sh
#
(/home/mischa/hue/get-sensors.py $(cat /home/mischa/hue-bridge) $(cat /home/mischa/hue-token) -b 60) | mail -s "Hue Battery Status" $(cat /home/mischa/hue-email)
result=$(/home/mischa/hue/get-sensors.py $(cat /home/mischa/hue-bridge) $(cat /home/mischa/hue-token) -b 20)
if [ -n "$result" ]; then
echo "${result}" | mail -s "Hue Battery Status" $(cat /home/mischa/hue-email)
fi