From 7f23afff5a037bbb223f7bdb0bf5af22b21be1f1 Mon Sep 17 00:00:00 2001 From: Jesus Alvarez Date: Mon, 12 Aug 2013 20:13:44 -0700 Subject: [PATCH] Start tracking scraper.sh This script will scrape the various webpages tied to the archzfs repository to monitory specific data points and send an email notifcation when they have changed. --- scraper.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 scraper.sh diff --git a/scraper.sh b/scraper.sh new file mode 100755 index 0000000..9ed5f10 --- /dev/null +++ b/scraper.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +REPO_BASEPATH="/data/pacman/repo" +REMOTE_LOGIN="jalvarez@jalvarez.webfactional.com" + +source "lib.sh" + +check_webpage() { + # $1: The url to scrape + # $2: The Perl regex to match with + # $3: Expect match + # Sends a message on mismatch + MSTR=$(curl -s "$1" | grep -Po "$2") + if [[ $MSTR != "$3" ]]; then + error "Checking \"$1\" expected \"$3\" got \"$MSTR\"" + fi +}