Last active
July 30, 2021 07:54
-
-
Save dhsathiya/e43f68f71249d42af42c83164d835e7b to your computer and use it in GitHub Desktop.
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/bash | |
IP=$(curl -4 icanhazip.com) | |
#echo $IP > /root/ip-changer/currentIPdd | |
OLD_IP=$(cat /root/ip-changer/currentIP) | |
echo "================ $(date) ================" >> /root/ip-changer/checkLog | |
if [ "$IP" != "$OLD_IP" ]; then | |
echo $IP > /root/ip-changer/currentIP | |
/usr/local/bin/cfcli edit curling.techio.dev $IP | |
echo "changed OLD_IP=$OLD_IP NEW_IP=$IP" >> /root/ip-changer/checkLog | |
fi | |
# Uses: https://www.npmjs.com/package/cloudflare-cli | |
# Cron | |
# * * * * * bash /root/ip-changer/main.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
New script
mkdir /root/ip-changer