Using bash to check a web server for PDF changes
Keeping up with elected official changes is a pain in the ass.
For a while I checked for changes when I thought of it, which caused the occasional histrionics. Then I switched to using the Google Civics API, which I figured was going to keep me from worrying about it. As it turns out, the Google Civics API is both (a) incomplete and often (b) inaccurate. For Mayor of Charlotte it lists the former mayor who was indicted and everybody in Charlotte wants desperately to forget about it. Hissy fits galore.
To top it off, our local Board of Elections stores that information in a PDF. Yay.
So I’m heading back off the Google Civics API again. This time I’m going to be a bit smarter about it however. Since I got all cloudy I have a real Linux server with real bash
ready to do real stuff. This bash script uses curl
to check the modified date on their PDF file from their web server against a date stored in a file. If the PDF was modified after that date, it downloads the file, emails it to me, and resets the check date in the file.
1 | 06-Jun-14 |
1 |
|
cron
it up for once a day, Bob’s your uncle. One hissy fit down, a few hundred to go.