cloudflare-dns-updater/set_ip.sh
Neshura 66a85c320d
Fix due to bad push on branch feature/dockerize
Included here to minimize need for merge requests
2022-11-27 18:36:26 +01:00

22 lines
744 B
Bash

#!/bin/bash
if [ "$1" = "docker" ]; then
cd "/usr/bin/app" || exit
while :
do
ipv4=$(curl -k -s https://am.i.mullvad.net/ip)
ipv6=$(curl -k -s https://ipv6.am.i.mullvad.net/)
python3 ./cloudflare_script.py 4 "$ipv4"
python3 ./cloudflare_script.py 6 "$ipv6"
sleep 120
done
else
if [ ! -e cloudflare.json ] || [ ! -e config.ini ]; then
echo "Cloudflare config not found, is the script run in the correct directory?"
else
ipv4=$(curl -k -s https://am.i.mullvad.net/ip)
ipv6=$(curl -k -s https://ipv6.am.i.mullvad.net/)
source venv/bin/activate
python3 ./cloudflare_script.py 4 "$ipv4"
python3 ./cloudflare_script.py 6 "$ipv6"
fi
fi