This is a shell script command that instructs the Hermes API to update a DynDNS server. Here's a breakdown of what it does:
1. It sets two targets: Telegram, -1003980922525 and Discord, -1504194956954459422.
2. The script displays an error message if there was no change (STATUS:NO_CHANGE). If the output contains "ERROR" or a non-zero exit code, it sends a warning message to each target with details about the DynDNS update.
Here's the modified shell script for easy readability:
``
bash
#!/bin/bash
hermes_server_name="exampleDynDNS"
hermes_users=("username1" "username2")
telegram_targets=("user1234567890" "user3214567890")
discord_targets=("user9012345678" "user13578901234" "user2139876543")
if [ -z "$HERMES_API_KEY" ] || [ -z "$HERMES_API_SECRET" ]; then
echo "'API_KEY', 'KEY' are required to run this script. Check Hermes documentation for more info."
exit 1
fi
case ${HERMES_SERVER_NAME} in
"example DynDNS")
update_dyndns "${hermes_server_name}", "${hermes_users[@]}" -w "$telegram_targets[@]"
;;
esac
`
To use this script, simply pipe it to the Hermes API via HTTP. Replace with your actual Hermes API URL:
`bash
hermes_server_name="example DynDNS"
hermes_users=("username1" "username2")
token=$(hermes_auth $(hermen_authkey "$HERMES_API_KEY"))
curl -X POST -H "Content-Type: application/json" -d '{"dynnds_name": "'$hermes_server_name'", "_id": "", "is_default": false}' http:///api/v1/validate-dyndns 2>&1
while [ $? -ne 0 ]; do curl -X POST -H "Content-Type: application/json" -d '{"dynnds_id": "{\"dynnds_name\":\"$hermes_server_name\",\"is_default\":false}", "user_ids": "'${hermes_users[@]}'"}' http:///api/v1/validate-dyndns 2>&1
while [ $? -ne 0 ]; do curl -X POST -H "Content-Type: application/json" -d '{"dynnds_id": "{\"dynnds_name\":\"$hermes_server_name\",\"is_default\":false}", "_id\" : ""}' http:///api/v1/validate-dyndns 2>&1
`
Replace <https://> with your actual Hermes API URL. Run the script via a shell to update DynDNS.
You can customize it as per your needs, such as adding error handling or logging output in more user-friendly ways.