I switched from Windows Server to a Arch LInux server with my scripts and applications. Therefore, I needed to port over my PowerShell script to something linux compatible to continue keeping my DDNS up-to-date. After some trial and error and some researching, here's a script to update Strato DDNS via a bash script!
With a cronjob executed every 5 mins, it checks through the website https://api.ipify.org the current internet IP address. Then it compares it with a previously saved IP address in the home directory of the current user. If the addresses are not equal, it updates the file and "curls" the strato https address with the given HOST and PASS variable to update the IP address.
Code:
#!/bin/bash
HOST=domain.de
PASS=mySecretPassword
CUR_IP=$(curl -s https://api.ipify.org)
if [ "$(<~/.oldipaddress)" != "$CUR_IP" ]
then
echo $CUR_IP > ~/.oldipaddress
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $(curl --silent --show-error --insecure --user $HOST:$PASS https://dyndns.strato.com/nic/update?hostname=$HOST)" >> ~/stratologs.txt
else
echo "[$(date '+%Y-%m-%d %H:%M:%S')] No change." >> ~/stratologs.txt
fi