#!/usr/bin/env bash # Script stores the current IP in a tmp file and later checks if it changed when run. POSTS to a Telegram bot. # Check how you can create a bot at https://core.telegram.org/bots old_ip=`cat /tmp/currentip` current_ip=`wget -qO- https://ipecho.net/plain` if [ $current_ip != $old_ip ]; then curl -s -X POST https://api.telegram.org/bot/sendMessage -d chat_id= -d text="Machine changed IP from: ${old_ip} to ${current_ip}" wget -qO- https://ipecho.net/plain > /tmp/currentip fi