-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathddupdater.py
34 lines (29 loc) · 1.11 KB
/
ddupdater.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from ddclient.providers.freedns import FreeDNS, FreeDNS2
from ddclient.providers.duckdns import DuckDNS
from ddclient.providers.Changeip import ChangeIP
from ddclient.Configurators.Logger import Log
from ddclient.Configurators.ConfigurationReader import FetchParameters
from ddclient.Configurators.Interface import GetIPfromInterface
from daemon import DaemonContext
from time import sleep
#config file path
config_file_path = "/etc/ddupdater.conf"
#daemonize
with DaemonContext():
while True:
#Read the config
provider, username, password, domain, iface_name, update_interval = FetchParameters(config_file_path)
ip = GetIPfromInterface(iface_name)
if (provider == FreeDNS):
FreeDNS(username, password, domain, ip)
if (provider == FreeDNS2):
FreeDNS2(username, password, domain, ip)
elif (provider == DuckDNS):
DuckDNS(password,domain,ip)
elif (provider == ChangeIP):
ChangeIP(username,password,domain,ip)
else :
Log("Unknown provider configured shutting down...")
Log("Provider configured : "+provider)
#sleep for expected time.
sleep(update_interval)