-
-
Save mohan-mu/8639c8a1cc14010738b2d5354caa7e0f to your computer and use it in GitHub Desktop.
Revisions
-
djromero revised this gist
Apr 13, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ URL="http://example.com/monitored/page.html" TO="email@example.com another@example.com" HANDLER="@user @friend" USERNAME="sender@gmail.com" PASSWORD="secret!" -
djromero revised this gist
Apr 13, 2015 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,11 +11,13 @@ # sudo apt-get install libio-socket-ssl-perl libcrypt-ssleay-perl libnet-ssleay-perl # sudo apt-get sendemail URL="http://example.com/monitored/page.html" TO="email@example.com another@example.com" HANDLER="@user @friend" USERNAME="sender@example.com" PASSWORD="secret!" while true ; do if [ -f new.html ] ; then -
djromero revised this gist
Apr 13, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,7 +32,7 @@ while true ; do -f $USERNAME \ -s smtp.gmail.com:587 -xu $USERNAME -xp $PASSWORD \ -o tls=yes \ -u "The page changed" \ -m "Visit it at $URL\n\n${DIFF_OUTPUT}" fi sleep 300 -
djromero created this gist
Apr 13, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ #!/bin/bash # inspired in "Monitoring a web page for changes using bash" # http://bhfsteve.blogspot.com.es/2013/03/monitoring-web-page-for-changes-using.html # monitor.sh - Monitors a web page for changes # sends an email notification and a tweet if the file changes # requirements: # - twitter from the command line [https://github.com/sferik/t] # gem install t # - sendemail # sudo apt-get install libio-socket-ssl-perl libcrypt-ssleay-perl libnet-ssleay-perl # sudo apt-get sendemail TO="email@example.com another@example.com" HANDLER="@user" USERNAME="sender@example.com" PASSWORD="secret!" URL="http://example.com/monitored/page.html" while true ; do if [ -f new.html ] ; then mv new.html old.html 2> /dev/null fi curl -s $URL -L --compressed > new.html # for better results add a grep to exclude lines that always change (like a date, etc.) # | egrep -v 'this|that' DIFF_OUTPUT=`diff --suppress-common-lines -y new.html old.html` if [ "x" != "x${DIFF_OUTPUT}" ] ; then t update "${HANDLER} hey, the webpage $URL just changed" sendEmail \ -t $TO \ -f $USERNAME \ -s smtp.gmail.com:587 -xu $USERNAME -xp $PASSWORD \ -o tls=yes \ -u "Entradas Rivas page changed" \ -m "Visit it at $URL\n\n${DIFF_OUTPUT}" fi sleep 300 done