Code Monkey home page Code Monkey logo

namesilo_ddns_cli's Introduction

Namesilo DDNS CLI

namesilo_ddns_cli is a command line tool for Namesilo DDNS, which is written in Bash depending on wget/curl only.

It is designed mainly to reduce dependences and system load as much as possible. Therefore, light-weight Linux distributions are especially appropriate to use it, like Raspberry, Openwrt, Merlin, Unraid, DSM, QTS...

Version 2 Upgrade (2020.11)

  • Rewrite based on Bash builtin commands, and remove all other dependences except for wget or curl.
  • No API request needed for normal running by using cache in log, and possible for IP-checking with high frequency.
  • Create running log with automatic compression and length control.
  • Enable command-line support.

Feathers

  • Multi-Domains Support
  • IPv4 & IPv6 Support
  • Load Balancing for IP-Check
  • Minimal API requests by Cache
  • Logging with Length Control

Requirements

  • wget or curl

Usage

Usage: namesilo_ddns.sh <command> ... [parameters ...]
Commands:
  --help                   Show this help message
  --version                Show version info
  --key, -k <apikey>       Specify Namesilo API key
  --host, -h <host>        Add a hostname
  --refetch, -r            Refetch records from Namesilo

Example:
  namesilo_ddns.sh -k c40031261ee449037a4b44b1 \
      -h yourdomain1.tld \
      -h subdomain1.yourdomain1.tld \
      -h subdomain2.yourdomain2.tld

Exit codes:
    0    Successfully updating for all host(s)
    2    Exist updating failed host(s)
    9    Arguments error

Tips:
  Strongly recommand to refetch records or clear caches in log,
  if your DNS records have been updated by other ways.

You can also edit the configs and settings in the head of script.

Applications

Regular Running for common Linux

  1. SSH to your device , and place namesilo_ddns.sh into somewhere, like /opt/ddns/. (Note: For EdgeOS, the script should be placed in /config/scripts/)

  2. Make sure your permissions of destination and script:

chmod u+w /opt/ddns
chmod u+x /opt/ddns/namesilo_ddns.sh
  1. Edit crontab config:
crontab -e
  1. Insert and save this line (updating the two hosts every 5 minutes):
*/5 * * * *  /opt/ddns/namesilo_ddns.sh -k c40031261ee449037a4b44b1 -h subdomain1.yourdomain1.tld -h subdomain2.yourdomain2.tld

Regular Running for Synology DSM

  1. Place namesilo_ddns.sh into somewhere in your NAS, e.g. /homes/<yourname>/ddns/.

  2. Start Control Panel, click Advanced Mode, open Task Scheduler.

  3. Access Create --> Scheduled Task --> User-defined script.

  4. Toggle to Schedule tab, set running every 5 minutes daily.

  5. Toggle to Task Settings tab, in Run command input edited command below, e.g.

/var/services/homes/<yourname>/ddns/namesilo_ddns.sh -k c40031261ee449037a4b44b1 -h subdomain1.yourdomain1.tld -h subdomain2.yourdomain2.tld
  1. If you check out Send run details by email and ... only when ... terminates abnormally, you will receive mail when occur error.

Use in Asuswrt-Merlin

Why use this solution? If you want to

  • DDNS multiple hosts

  • DDNS IPv6 hosts

  • reduce API requests greatly

  • check updating log

Setup

  1. Edit the API key and hosts in this script, and save as ddns-start.
#!/usr/bin/env bash

./namesilo_ddns.sh -k c40031261ee449037a4b44b1 \
      -h subdomain1.yourdomain1.tld \
      -h subdomain2.yourdomain2.tld

if [ $? -eq 0 ]; then
  /sbin/ddns_custom_updated 1
else
  /sbin/ddns_custom_updated 0
fi
  1. SSH to your router and place ddns-start and namesilo_ddns.sh under /jffs/scripts/.

  2. Make sure your permissions of destination and script:

chmod u+w /jffs/scripts
chmod u+x /jffs/scripts/namesilo_ddns.sh
chmod u+x /jffs/scripts/ddns-start
  1. Log into the router web UI:
    • Go to Advanced Settings > WAN > DDNS
    • Set Server to Custom
    • Click the Apply button

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.