Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # monitor.sh - Monitors a web page for changes
  4. # sends an email notification if the file change
  5.  
  6. USERNAME="me@gmail.com"
  7. PASSWORD="itzasecret"
  8. URL="http://thepage.com/that/I/want/to/monitor"
  9.  
  10. for (( ; ; )); do
  11.     mv new.html old.html 2> /dev/null
  12.     curl $URL -L --compressed -s > new.html
  13.     DIFF_OUTPUT="$(diff new.html old.html)"
  14.     if [ "0" != "${#DIFF_OUTPUT}" ]; then
  15.         sendEmail -f $USERNAME -s smtp.gmail.com:587 \
  16.             -xu $USERNAME -xp $PASSWORD -t $USERNAME \
  17.             -o tls=yes -u "Web page changed" \
  18.             -m "Visit it at $URL"
  19.         sleep 10
  20.     fi
  21. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement