Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specify path to python in cronjob string? #4

Open
simgitlochub opened this issue Feb 9, 2023 · 4 comments
Open

specify path to python in cronjob string? #4

simgitlochub opened this issue Feb 9, 2023 · 4 comments
Assignees

Comments

@simgitlochub
Copy link

Hi I am new to github and not even a programmer - a tinkerer really. First off - thank you very much for writing this python script! But I haven't been able to get it to work! :( I don't what I am doing, but I think maybe the string has to first specify to execute the script using python3 and include the path to python3 as well, right?
Should it look something rather like this?

*/15 * * * * /usr/bin/python3 ./ionos_dyndns.py --AAAA --api-prefix my_prefix_string --api-secret my_secret_string

@lazaroblanc
Copy link
Owner

Hi @simgitlochub
Thank you for your feedback.

Your call of the script looks correct.
Is the script executable? Check the file mode...
Do you get any error messages?
Does it work when you execute that line without the cron part? (just /usr/bin/python3 ./ionos_dyndns.py --AAAA --api-prefix my_prefix_string --api-secret my_secret_string)

@lazaroblanc lazaroblanc self-assigned this Feb 9, 2023
@simgitlochub
Copy link
Author

simgitlochub commented Feb 9, 2023

Hi! Thank you for your reply!

I checked the file (with the command) and get the result:

ionos_dyndns.py: Python script, UTF-8 Unicode text executable

So i guess it's good to go.
I had a bunch of problems with PIP (pyopenssl was messed up) and other stuff which are fixed now, but here is my current error:

Traceback (most recent call last):
File "ionos_dyndns.py", line 190, in
main()
File "ionos_dyndns.py", line 90, in main
domain = get_domain_from_fqdn(fqdn)
File "ionos_dyndns.py", line 139, in get_domain_from_fqdn
return re.search(regex, fqdn, re.IGNORECASE).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

@mricim
Copy link
Contributor

mricim commented Mar 18, 2023

Same mistake.

The problem seems to be in:

def get_domain_from_fqdn(fqdn):
    regex = r"(?:(?:\w|-)+\.)+(\w+\.\w+)$"
    return re.search(regex, fqdn, re.IGNORECASE).group(1)
domain = get_domain_from_fqdn(fqdn)

The line re.search(regex, fqdn, re.IGNORECASE).group(1) return "None"
If you modified zone = get_zone(domain) to zone = get_zone("domain.com") or zone = get_zone(fqdn) works.
Surely we are doing something wrong, but I don't know what

@mricim
Copy link
Contributor

mricim commented Dec 30, 2023

It turns out that the script was configured only to work with "www." prefixes in domain names. I've submitted pull request #6 to make it now accept both "domain.com" and the subdomain "www.domain.com."

I believe that with these changes, the functionality should be more versatile and address the original concern raised in the issue. It might be beneficial to consider adding additional documentation on how to use the -H option to specify the full host name. This would provide clearer guidance for users.

I think this issue can now be closed. I appreciate any further review and suggestions before officially closing it. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants