Skip to content

Instantly share code, notes, and snippets.

@matthiasr
Created October 23, 2011 20:52
Show Gist options
  • Save matthiasr/1307877 to your computer and use it in GitHub Desktop.
Save matthiasr/1307877 to your computer and use it in GitHub Desktop.
check if 28C3 presale is online. add this as a cronjob.
#!/bin/sh
URLS="http://presale.events.ccc.de/ https://presale.events.ccc.de/"
MAILTO="foo@example.com bar@example.org"
TIMEOUT=10
for URL in $URLS; do
DONEFILE=${PWD}/.urlcheckdone.$(echo ${URL} | sed -e 's/[^-[:alnum:]_]/_/g')
[ -f ${DONEFILE} ] && continue
if [ ! $(curl -s ${URL} --connect-timeout ${TIMEOUT} |wc -c) -eq 0 ]; then
{ cat << EOF
${URL} just came online!
Love,
your checkerbot.
EOF
} | mail -s "${URL} online check" ${MAILTO}
touch ${DONEFILE}
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment