Last active
April 27, 2017 23:19
-
-
Save cmheisel/13585e30ced4829e31be0fd0943e6761 to your computer and use it in GitHub Desktop.
Web site comparisons
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 characters
#!/bin/bash | |
set -eou pipefail | |
cd /home/cmheisel/webapps/isittikiseason_static/mc | |
URL="https://mailchimp.com/about/jobs/all/" | |
DATADIR="./data" | |
DIFFDIR="./diffs" | |
DATE=`date +%Y-%m-%d_%H-%M-%S` | |
mkdir -p ${DATADIR} | |
mkdir -p ${DIFFDIR} | |
wget -O ${DATADIR}/index.html --quiet https://mailchimp.com/about/jobs/all/ | |
if [ -a ${DATADIR}/previous.html ]; then | |
is_diff=$(diff ${DATADIR}/index.html ${DATADIR}/previous.html || true) | |
if [ -z "${is_diff}" ]; then | |
# No Diff found this period | |
true | |
else | |
echo "${is_diff}" > ${DIFFDIR}/diff-${DATE}.diff | |
cp ${DATADIR}/index.html ${DATADIR}/index-${DATE}.html | |
echo "${is_diff}" | |
fi | |
elif [ -a ${DATADIR}/index.html ]; then | |
cp ${DATADIR}/index.html ${DATADIR}/index-${DATE}.html | |
fi | |
cp ${DATADIR}/index.html ${DATADIR}/previous.html | |
echo "${DATE}" > jobs.lastrun |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment