Guest User

Untitled

a guest
Apr 13th, 2015
233
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="[email protected]"
  3. subject="Alert"
  4. message_txt="Nothing Found is catched at $d"
  5.  
  6.  
  7. declare file="alert.txt"
  8. declare regex="\s+ Cannot \s+"
  9. declare regex2="\s+ Nothing Found \s+"
  10.  
  11. declare file_content=$( cat "${file}" )
  12.  
  13.  
  14. wget -O - url/alert.php | grep "Cannot\|Nothing found" > alert.txt
  15.  
  16.  
  17. if [[ " $file_content " =~ $regex2 ]] # please note the space before and after the file content
  18. then
  19. /usr/sbin/sendmail "$recipients" << EOF
  20. subject:$subject
  21. from:$from
  22. $message_txt
  23.  
  24. EOF
  25. fi
  26. exit
Advertisement
Add Comment
Please, Sign In to add comment