Trying to set a cronjob to use with curl. Want to update IP on noip.com. The command below gets the IP from noip.com but does not update it with my servers ip. I mean: when the IP is not updated then I get the old one:

curl -X GET 'https://dynupdate.no-ip.com/nic/update' --header "Authorization: Basic $(base64 <<< $xxxxxxx:$xxxxxx)" -d "hostname=$xxxxx.ddns.net"

this command below poduces error sh: GET: command not found

ExecStart=/usr/bin/curl-X GET 'https://dynupdate.no-ip.com/nic/update' --header "Authorization: Basic <$xxxxx:$xxxxx>" -d 'hostname=<hostname>.xxxxxx.ddns.net'

Need help for an appropriate script

  • Why does the second command have an ExecStart= in front of it?
    – user1686
    Dec 4 '18 at 14:38
  • Actually I have copied from a forum :) don't know its accuracy
    – ddinc
    Dec 4 '18 at 14:58

On a modern Linux system, you do not want to use crontab, but systemd timers.

Create the file /etc/systemd/system/updateip.service with the following content:

Description=Update IP

ExecStart=/usr/bin/curl -X GET 'https://dynupdate.no-ip.com/nic/update' --header "Authorization: Basic <$xxxxx:$xxxxx>" -d 'hostname=<hostname>.xxxxxx.ddns.net'

Now you add a timer in /etc/systemd/system/updateip.timer with the following contents, to run every 10 minutes:

Description=Update IP every 10 minutes


Enable the timer by running systemctl start updateip.timer


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.