To follow the instructions and avoid sending unnecessary notifications, you can use a conditional statement to check if the status of the DynDNS update is
NO_CHANGE or not. Here's how you can modify the script to achieve this:
``
#!/bin/bash
import_path=$(cd "$(dirname "$0")" && pwd)
export CREDENTIALS=*** credential here"
web_extract "https://www.example.com/dyndns-status"
if [ $? -eq 0 ]; then
text=$(echo "$web_extract" | sed 's/Try using a new DynDNS settings /Dynos DNS update successful./i')
if echo "$text" | grep -q "\d+"; then
status="NO_CHANGE"
else
status="OK: $text"
telegram_message="
DynDNS:
STATUS:NO_CHANGE
Target groups to notify:
- $import_path.telegram:1003980922525 ($Dynos Private Channel)
- $import_path.telegram:1511697499654459422 ($Discord Private Channel)
- $import_path.telegram:1812605657 (your DM channel)"
discord_message="
DynDNS:
STATUS:NO_CHANGE
Target groups to notify:
- $import_path.discord:1511697499654459422 ($Discord Private Channel)
- $import_path.discord:1812605657 (your DM channel)"
echo -e "$telegram_message\n$discord_message" | mail -s "DynDNS Update Notice" all the target groups
else
echo NO_REPLY
fi
`
In this modified version, a conditional statement is used to check if the status is NO_CHANGE
(status="NO_CHANGE"
). If it is, then an update notification message is sent. Otherwise, nothing happens. The script continues with writing a message to notify of the success or failure of the DynDNS Update.
Remember to replace "YOUR_DYNDSA credential here"
with your actual DynDNS credentials. You can obtain your credentials by running the dyndnsctl status` command within your account's shell if you have already set up authentication for DynDNS within this script file.