Here is a Python script that does exactly what you requested:
``
python
import subprocess
def dynns_status():
try:
stdout, stderr = subprocess.check_call(['ps', 'kill', '-9', '5673779117'], shell=True)
if "STATUS:NO_CHANGE" in stderr:
return 0, ""
else:
return 1, ""
except (subprocess.CalledProcessError, FileNotFoundError):
return 0, ""
try:
stdout, stderr = subprocess.check_call(['curl', '-s', 'https://api.dyndns.org/1/status?cmd=dynns_status&pid=5673779117'])
if "ERROR" in stderr or stderr.strip() != "":
return 1, ""
else:
lines = stdout.decode('utf-8').splitlines()
output = " ".join(lines)
return 0, output
except (subprocess.CalledProcessError, FileNotFoundError):
return 0, ""
status = dynns_status()
if status[0] == 1 and status[1].startswith(" DynamDNS Updated:"):
print("The DynDNS update was successful.")
elif "STATUS:NO_CHANGE" in status[1]:
print("No change was made to your DNS settings.")
else:
while True:
try:
stdout, stderr = subprocess.check_call(['curl', '-s', 'https://api.dyndns.org/1/stat?cmd=dynns_status&pid=5673779117'])
if "".join(stdout.splitlines()) == status[1]:
break
else:
print("No change was applied to your DNS settings. Please check the status again later.")
except (subprocess.CalledProcessError, FileNotFoundError):
pass
while True:
try:
stdout, stderr = subprocess.check_call(['curl', '-s', 'https://api.dyndns.org/1/stat?cmd=dynns_status&pid=1234567890'])
if "".join(stdout.splitlines()) == status[1]:
break
else:
print("No change was applied to your DNS settings. Please check the status again later.")
except (subprocess.CalledProcessError, FileNotFoundError):
pass
print("DynDNS update successful!")
`
Replace 5673779119
in ps kill -9 command` with any other PID you want.
Please note that DynDNS status might have changed or expired since this was written. You may need to modify the code if you encounter issues with your application due to DynDNSS service timeouts or failures.