#!/bin/bash
DISPLAY=":0.0"
XAUTHORITY="/home/me/.Xauthority"
XDG_RUNTIME_DIR="/run/user/1001"
fetch_url1=$(/usr/bin/wget -qO- http://mydomain.com/something.xml);
checkhep_title ()
{
notify_counter=0;
alert1='foo';
alert2='bar';
live=$(echo "$fetch_url1" | /bin/grep 'title' | /bin/grep -E "$alert1|$alert2" | /bin/sed -e 's/<[^>]*>//g' | /usr/bin/perl -MHTML::Entities -e 'while(<>) {print decode_entities($_);}');
[ $notify_counter -eq 0 ] && [[ "$live" == *"$alert1"* || "$live" == *"$alert2"* ]] && { /usr/bin/notify-send -t 20000 -u critical -i /home/me/Pictures/Misc/storm.png "ALERT ยป" "Description: $live"; /usr/bin/aplay /home/me/sound/sound.wav; notify_counter=1; }
}
/bin/sleep 30
checkhep_title &