Skip to content

Instantly share code, notes, and snippets.

@niltonvasques
Created February 17, 2017 19:11
Show Gist options
  • Select an option

  • Save niltonvasques/d89a0d79a0dbbcee8befbfbd46b8097b to your computer and use it in GitHub Desktop.

Select an option

Save niltonvasques/d89a0d79a0dbbcee8befbfbd46b8097b to your computer and use it in GitHub Desktop.
Detect page changes and emit a high beep
# lynx --dump URL > old.html && watch -n 10 "./detect_page_change.sh"
#
#!/bin/bash
RESULT=`diff old.html <(lynx --dump URL)`
if [ "x`printf '%s' "$RESULT" | tr -d "$IFS"`" = x ]; then
echo "NOTHING NEW"
else
( speaker-test -t sine -f 1000 )& pid=$! ; sleep 3.1s ; kill -9 $pid
echo "NEWS"
echo $RESULT
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment