Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- d=`date +%Y-%m-%d_%H-%M-%S`
- recipients="something@gmail.com"
- subject="Alert"
- from="something@something.com"
- message_txt="Nothing Found is catched at $d"
- declare file="alert.txt"
- declare regex="\s+ Cannot \s+"
- declare regex2="\s+ Nothing Found \s+"
- declare file_content=$( cat "${file}" )
- wget -O - url/alert.php | grep "Cannot\|Nothing found" > alert.txt
- if [[ " $file_content " =~ $regex2 ]] # please note the space before and after the file content
- then
- /usr/sbin/sendmail "$recipients" << EOF
- subject:$subject
- from:$from
- $message_txt
- EOF
- fi
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement