Development
This commit is contained in:
parent
d0cfffac52
commit
adcfe55c7c
24 changed files with 405 additions and 359 deletions
|
|
@ -2,7 +2,7 @@
|
|||
"""
|
||||
ddns.py -- Update DDNS provider(s) with current public IP.
|
||||
|
||||
Reads the ddns block from core.json, fetches the current public IP,
|
||||
Reads the ddns block from config.json, fetches the current public IP,
|
||||
and updates each enabled provider block only if the IP has changed
|
||||
since the last successful update for that provider.
|
||||
Designed to be run on a systemd timer managed by core.py --apply.
|
||||
|
|
@ -16,7 +16,7 @@ Logs to ddns.log in the same directory as this script.
|
|||
Log is cleared when it exceeds general.log_max_kb from config.
|
||||
|
||||
Usage:
|
||||
python3 ddns.py --apply Run update once (used by timer)
|
||||
python3 ddns.py --update Run update once (used by timer)
|
||||
python3 ddns.py --force Force update regardless of cached IP
|
||||
python3 ddns.py --getip Print current public IP and exit
|
||||
"""
|
||||
|
|
@ -32,7 +32,7 @@ import logging
|
|||
from pathlib import Path
|
||||
|
||||
SCRIPT_DIR = Path(__file__).parent
|
||||
CONFIG_FILE = SCRIPT_DIR / "core.json"
|
||||
CONFIG_FILE = SCRIPT_DIR / "config.json"
|
||||
CACHE_SERVICE_FILE = SCRIPT_DIR / ".ddns-last-service"
|
||||
LOG_FILE = SCRIPT_DIR / "ddns.log"
|
||||
|
||||
|
|
@ -512,18 +512,18 @@ def main():
|
|||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
epilog=(
|
||||
"examples:\n"
|
||||
" python3 ddns.py --apply Run update once (used by timer)\n"
|
||||
" python3 ddns.py --update Run update once (used by timer)\n"
|
||||
" python3 ddns.py --force Force update regardless of cached IP\n"
|
||||
" python3 ddns.py --getip Print current public IP and exit\n"
|
||||
)
|
||||
)
|
||||
parser.add_argument("--apply", action="store_true", help="Run update once (used by timer)")
|
||||
parser.add_argument("--update", action="store_true", help="Run update once (used by timer)")
|
||||
parser.add_argument("--force", action="store_true", help="Force update regardless of cached IP")
|
||||
parser.add_argument("--getip", action="store_true", help="Print current public IP and exit")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if not any([args.apply, args.force, args.getip]):
|
||||
if not any([args.update, args.force, args.getip]):
|
||||
parser.print_help()
|
||||
return
|
||||
|
||||
|
|
@ -540,7 +540,7 @@ def main():
|
|||
general = cfg["general"]
|
||||
setup_logging(general["log_max_kb"], general["log_errors_only"])
|
||||
|
||||
if args.apply or args.force:
|
||||
if args.update or args.force:
|
||||
run_update(cfg, force=args.force)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue