Created
March 29, 2016 11:50
-
-
Save wrzlbrmft/fe981ee496db7de8177a to your computer and use it in GitHub Desktop.
Check a URL for a string and send an e-mail if found.
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 | |
CHECK_URL="https://store.google.com/" | |
CHECK_STRING="Nexus 5" | |
MAIL_TO="mail@example.org" | |
MAIL_SUBJECT="$CHECK_STRING" | |
MAIL_BODY="$CHECK_URL" | |
COUNT="$(curl -Ls "$CHECK_URL" | grep -c "$CHECK_STRING")" | |
if [ "$COUNT" != "0" ]; then | |
printf "$MAIL_BODY\n" | mail -s "$MAIL_SUBJECT" "$MAIL_TO" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment