Create a crontab script with curl












0














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










share|improve this question
























  • Why does the second command have an ExecStart= in front of it?
    – grawity
    Dec 4 at 14:38










  • Actually I have copied from a forum :) don't know its accuracy
    – ddinc
    Dec 4 at 14:58
















0














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










share|improve this question
























  • Why does the second command have an ExecStart= in front of it?
    – grawity
    Dec 4 at 14:38










  • Actually I have copied from a forum :) don't know its accuracy
    – ddinc
    Dec 4 at 14:58














0












0








0







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










share|improve this question















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







linux cron curl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 4 at 16:16









oh.dae.su

1801110




1801110










asked Dec 4 at 14:19









ddinc

11




11












  • Why does the second command have an ExecStart= in front of it?
    – grawity
    Dec 4 at 14:38










  • Actually I have copied from a forum :) don't know its accuracy
    – ddinc
    Dec 4 at 14:58


















  • Why does the second command have an ExecStart= in front of it?
    – grawity
    Dec 4 at 14:38










  • Actually I have copied from a forum :) don't know its accuracy
    – ddinc
    Dec 4 at 14:58
















Why does the second command have an ExecStart= in front of it?
– grawity
Dec 4 at 14:38




Why does the second command have an ExecStart= in front of it?
– grawity
Dec 4 at 14:38












Actually I have copied from a forum :) don't know its accuracy
– ddinc
Dec 4 at 14:58




Actually I have copied from a forum :) don't know its accuracy
– ddinc
Dec 4 at 14:58










1 Answer
1






active

oldest

votes


















0














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:



[Unit]
Description=Update IP

[Service]
Type=oneshot
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:



[Unit]
Description=Update IP every 10 minutes

[Timer]
OnCalendar=*:0/10


Enable the timer by running systemctl start updateip.timer






share|improve this answer





















  • I did but IP on noip is not updated.When running ExecStart=/usr/bin/curl -X GET 'dynupdate.no-ip.com................ I get:X command not found.The reason for opening this thread was that there was a certişficate error which could not be reproduced by noip support.1drv.ms/u/s!Am4yMVdZjYGSgYwp5tnXweWVLR5JLQ today I did not see this error but Ithere was no IP update: 1drv.ms/u/s!Am4yMVdZjYGSgYwyHUu-aSnX5eRI2w
    – ddinc
    Dec 5 at 8:37












  • Solved.............
    – ddinc
    Dec 7 at 10:02











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1380720%2fcreate-a-crontab-script-with-curl%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














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:



[Unit]
Description=Update IP

[Service]
Type=oneshot
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:



[Unit]
Description=Update IP every 10 minutes

[Timer]
OnCalendar=*:0/10


Enable the timer by running systemctl start updateip.timer






share|improve this answer





















  • I did but IP on noip is not updated.When running ExecStart=/usr/bin/curl -X GET 'dynupdate.no-ip.com................ I get:X command not found.The reason for opening this thread was that there was a certişficate error which could not be reproduced by noip support.1drv.ms/u/s!Am4yMVdZjYGSgYwp5tnXweWVLR5JLQ today I did not see this error but Ithere was no IP update: 1drv.ms/u/s!Am4yMVdZjYGSgYwyHUu-aSnX5eRI2w
    – ddinc
    Dec 5 at 8:37












  • Solved.............
    – ddinc
    Dec 7 at 10:02
















0














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:



[Unit]
Description=Update IP

[Service]
Type=oneshot
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:



[Unit]
Description=Update IP every 10 minutes

[Timer]
OnCalendar=*:0/10


Enable the timer by running systemctl start updateip.timer






share|improve this answer





















  • I did but IP on noip is not updated.When running ExecStart=/usr/bin/curl -X GET 'dynupdate.no-ip.com................ I get:X command not found.The reason for opening this thread was that there was a certişficate error which could not be reproduced by noip support.1drv.ms/u/s!Am4yMVdZjYGSgYwp5tnXweWVLR5JLQ today I did not see this error but Ithere was no IP update: 1drv.ms/u/s!Am4yMVdZjYGSgYwyHUu-aSnX5eRI2w
    – ddinc
    Dec 5 at 8:37












  • Solved.............
    – ddinc
    Dec 7 at 10:02














0












0








0






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:



[Unit]
Description=Update IP

[Service]
Type=oneshot
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:



[Unit]
Description=Update IP every 10 minutes

[Timer]
OnCalendar=*:0/10


Enable the timer by running systemctl start updateip.timer






share|improve this answer












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:



[Unit]
Description=Update IP

[Service]
Type=oneshot
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:



[Unit]
Description=Update IP every 10 minutes

[Timer]
OnCalendar=*:0/10


Enable the timer by running systemctl start updateip.timer







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 4 at 17:01









Eloy

465




465












  • I did but IP on noip is not updated.When running ExecStart=/usr/bin/curl -X GET 'dynupdate.no-ip.com................ I get:X command not found.The reason for opening this thread was that there was a certişficate error which could not be reproduced by noip support.1drv.ms/u/s!Am4yMVdZjYGSgYwp5tnXweWVLR5JLQ today I did not see this error but Ithere was no IP update: 1drv.ms/u/s!Am4yMVdZjYGSgYwyHUu-aSnX5eRI2w
    – ddinc
    Dec 5 at 8:37












  • Solved.............
    – ddinc
    Dec 7 at 10:02


















  • I did but IP on noip is not updated.When running ExecStart=/usr/bin/curl -X GET 'dynupdate.no-ip.com................ I get:X command not found.The reason for opening this thread was that there was a certişficate error which could not be reproduced by noip support.1drv.ms/u/s!Am4yMVdZjYGSgYwp5tnXweWVLR5JLQ today I did not see this error but Ithere was no IP update: 1drv.ms/u/s!Am4yMVdZjYGSgYwyHUu-aSnX5eRI2w
    – ddinc
    Dec 5 at 8:37












  • Solved.............
    – ddinc
    Dec 7 at 10:02
















I did but IP on noip is not updated.When running ExecStart=/usr/bin/curl -X GET 'dynupdate.no-ip.com................ I get:X command not found.The reason for opening this thread was that there was a certişficate error which could not be reproduced by noip support.1drv.ms/u/s!Am4yMVdZjYGSgYwp5tnXweWVLR5JLQ today I did not see this error but Ithere was no IP update: 1drv.ms/u/s!Am4yMVdZjYGSgYwyHUu-aSnX5eRI2w
– ddinc
Dec 5 at 8:37






I did but IP on noip is not updated.When running ExecStart=/usr/bin/curl -X GET 'dynupdate.no-ip.com................ I get:X command not found.The reason for opening this thread was that there was a certişficate error which could not be reproduced by noip support.1drv.ms/u/s!Am4yMVdZjYGSgYwp5tnXweWVLR5JLQ today I did not see this error but Ithere was no IP update: 1drv.ms/u/s!Am4yMVdZjYGSgYwyHUu-aSnX5eRI2w
– ddinc
Dec 5 at 8:37














Solved.............
– ddinc
Dec 7 at 10:02




Solved.............
– ddinc
Dec 7 at 10:02


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1380720%2fcreate-a-crontab-script-with-curl%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

Puebla de Zaragoza

Musa