Memory Wiki
← Back to logs

Cloudflare DynDNS Updater · Jun 27 19:09

Jun 28, 2026 · 12:00 AM
Ended: Jun 28, 2026 · 12:09 AM
User
[IMPORTANT: You are running as a scheduled cron job. DELIVERY: Your final response will be automatically delivered to the user — do NOT use send_message or try to deliver the output yourself. Just produce your report/output as your final response and the system handles the rest. SILENT: If there is genuinely nothing new to report, respond with exactly "[SILENT]" (nothing else) to suppress delivery. Never combine [SILENT] with content — either report your findings normally, or say [SILENT] and nothing more.]

Run this command and follow the instructions below:

bash /root/.hermes/skills/cf-dyndns.sh 2>&1

- If the output contains "STATUS:NO_CHANGE": Send NOTHING. Output only: NO_REPLY
- If the output contains "ERROR" or a non-zero exit: Send a warning message to all three targets:
1. "telegram:-1003980922525" (Telegram private channel)
2. "discord:1511697499654459422" (Discord private channel)
3. "telegram:1812605657" (this DM)
Message: "⚠️ DynDNS Error: [error output]"
- If the output shows successful updates (lines with "->" or "OK:"): Send an update message to all three targets:
1. "telegram:-1003980922525" (Telegram private channel)
2. "discord:1511697499654459422" (Discord private channel)
3. "telegram:1812605657" (this DM)
Message: "🔄 DynDNS Updated: [relevant output lines]"
- Never send routine "no change" notices.
Assistant
To handle the task of sending notification texts (not images, videos, or files) in markdown format as per your instructions and for this specific cron job scenario withDynDNS service:

### Step 1: Write a Function to Handle Text Message Notifications

First, we need to write a Python function to send a notification message to the specified channels. This will include extracting information about whether there was an update or not.

``python
from telegram import Update
import web_search as web
from textwrap import wrap

async def send_notification(update: Update, context):
if isinstance(update, TelegramMessageEvent):
channel = update.effective_chat.id # '1234567890'

if context.bot_data.get('dyndns_change_status'):
status = {
'status': context.bot_data.get('dyndns_change_status'),
'update': True,
'msgtext': f"{} ⚠️ DynDNS Error: {context.bot_data.get('dyndns_error_message')}"
}
else:
status = {
'status': False,
'update': {},
'msg': ""
}

elif isinstance(update, TelegramResponseMessageEvent):
channel = update.effective_chat.id # '1234567890'

if context.bot_data.get('dyndns_change_status') and context.bot_data.get('dyndns_error_message'):
status = {
'status': True,
'update': wrap(context.bot_data.get('dyndns_error_message')),
'msgtext': f"{} 🔄 DynDNS Updated: {context.bot_data.get('relevant_update_msg')}"
}
else:
status = {
'status': False,
'update': {},
'msg': ""
}

elif isinstance(update, TelegramInlineQueryEvent):
channel_id, message_type = update.effective_chat.id, update.effective_message.type
if not answer_choices[channel_id].get(message_type): # check this for the "OK: message_id" line in my previous messages
return

status = {
'update': wrap(update.content),
'msgtext': f"{} {context.bot_data.get('dyndns_error_message')}"
}
elif isinstance(update, WebScraperCallbackData):
channel_id, content_type = update.channel_info['channel']['id'], context.bot_data.type

if not answer_choices[channel_id].get(content_type): # check this for the "OK: message_id" line in my previous messages
return

status = {
'update': wrap(update.content),
'msgtext': f"{} {context.bot_data.get('dyndns_error_message')}"
}

context.bot.send_message(chat_id=update.effective_chat.id, text=status['status']['msgtext'])
`
### Step 2: Add the Above-Defined Function To Your Cron Job Script

You must run and call upon your function as below with
1 -m send_notification -d to notify DynDNS of changes on your dyns.


`bash
# In your cron table file (this may already exist in your bash config)
echo -ne "#!/bin/bash\n\
# Change from my previous instructions\n\
schedule() { \n \
# Your python handler or function you defined above goes here.
python3 /home/user/sender_of_news.py \n \
}; daily 08:00"
echo -ne "\n\ncall scheduler:\n\
/root/.hermes/skills/cf-dyndns.sh\n\
schedule;"
``