Advertisement
Guest User

Untitled

a guest
Apr 13th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. d=`date +%Y-%m-%d_%H-%M-%S`
  2. recipients="something@gmail.com"
  3. subject="Alert"
  4. from="something@something.com"
  5. message_txt="Nothing Found is catched at $d"
  6.  
  7.  
  8. declare file="alert.txt"
  9. declare regex="\s+ Cannot \s+"
  10. declare regex2="\s+ Nothing Found \s+"
  11.  
  12. declare file_content=$( cat "${file}" )
  13.  
  14.  
  15. wget -O - url/alert.php | grep "Cannot\|Nothing found" > alert.txt
  16.  
  17.  
  18. if [[ " $file_content " =~ $regex2 ]] # please note the space before and after the file content
  19. then
  20. /usr/sbin/sendmail "$recipients" << EOF
  21. subject:$subject
  22. from:$from
  23. $message_txt
  24.  
  25. EOF
  26. fi
  27. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement