Last active
          June 8, 2020 06:39 
        
      - 
      
- 
        Save HirbodBehnam/6c6b218645efe5087759ac2ce09bd7fc to your computer and use it in GitHub Desktop. 
    A simple script to watch a url for changes
  
        
  
    
      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 | |
| URL="$1" | |
| TOKEN="Telegram Bot Token" | |
| CHAT_ID="Your Chat ID" # for example use @myidbot | |
| temp_file=$(mktemp) | |
| curl -o $temp_file "$URL" | |
| sum=$(md5sum $temp_file) | |
| while : | |
| do | |
| sleep 3600 | |
| curl -o $temp_file "$URL" | |
| sum2=$(md5sum $temp_file) | |
| if [[ "$sum" != "$sum2" ]]; then | |
| curl -X POST -d text="$URL" -d chat_id=$CHAT_ID https://api.telegram.org/bot$TOKEN/sendMessage | |
| rm $temp_file | |
| exit | |
| fi | |
| done | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment