Created
December 7, 2010 11:05
-
-
Save yanbe/731680 to your computer and use it in GitHub Desktop.
Check arbitrary PDF file on the web and mail diff from last version if it has changed.
This file contains 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 characters
#!/bin/sh | |
export PATH=/opt/bin:$PATH | |
URL=http://example.com/kushitu.pdf | |
CUR_LENGTH=`curl --head $URL 2>/dev/null | awk '/Content-Length:/ {print $2}'` | |
cd /home/john/kushitu_checker | |
if [ $CUR_LENGTH != `cat last_length` ]; then | |
curl $URL > kushitu.pdf | |
pdftotext -enc UTF-8 -raw kushitu.pdf /dev/stdout | sed 's/^.*現在//g' > kushitu.txt | |
diff -U 0 kushitu.txt last_kushitu.txt | nail -A myaccount -s "Room Updates" john@example.com | |
echo $CUR_LENGTH > last_length; rm kushitu.pdf; mv kushitu.txt last_kushitu.txt | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment