-1

I get:

root@dm820:~# ExecStart=/usr/bin/curl'https://dynupdate.no-ip.com/nic/update' --header "Authorization: Basic <$xxxx:$xxx>" -d 'hostname=<hostname>.xxxx.ddns.net'
-sh: --header: command not found
mtak
  • 16,513
  • 2
  • 52
  • 64
ddinc
  • 1
  • 2
  • 3
    What are you trying to achieve? Where did you get this line? It's not a command, but a snipped from systemd service. – gronostaj Dec 06 '18 at 12:01

2 Answers2

1

what do I make wrong?

ExecStart=/usr/bin/curl'https://dynupdate.no-ip.com/nic/update' --header "Authorization: Basic <$xxxx:$xxx>" -d 'hostname=<hostname>.xxxx.ddns.net'
  1. You're defining ExecStart variable and trying to run --header. The syntax is like

    foo=bar some_command option1 option2
    
  2. You're using the full path /usr/bin/curl. Unless you know it's right and you need the full path, you should rely on your $PATH and use just curl.

  3. You have no space after curl.

  4. You're trying to run curl as root.

  5. You're running a command (like random code from the Internet?) you apparently don't understand as root.

To fix:

  • Write 100 times "I won't run commands I don't understand as root". :)
  • Drop ExecStart=, it's a part of systemd syntax.
  • Use just curl.
  • Put a space after curl.

It will be like

curl 'https://dynupdate.no-ip.com/nic/update' --header "Authorization: Basic <$xxxx:$xxx>" -d 'hostname=<hostname>.xxxx.ddns.net'

where <$xxxx:$xxx> and <hostname> are still placeholders you need to change to something valid.

Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
  • To simplify things a bit more, it would be like `curl https://dynupdate.no-ip.com/nic/update --user '$xxxx:$xxx' -d 'hostname=.xxxx.ddns.net'` – u1686_grawity Dec 06 '18 at 12:30
  • @grawity Frankly I don't know `curl` and such to tell if you're right. The answer is now community wiki, so please improve it freely. – Kamil Maciorowski Dec 06 '18 at 12:33
  • Thanks.Yes it's from internet :https://superuser.com/questions/1380720/create-a-crontab-script-with-curl :) Shall I write down all 100 or can I copy paste :) :) – ddinc Dec 06 '18 at 13:28
0

If you want to run this from the command line and not from systemd, you have to run it like this:

curl 'https://dynupdate.no-ip.com/nic/update' --header "Authorization: Basic <$xxxx:$xxx>" -d 'hostname=<hostname>.xxxx.ddns.net'
mtak
  • 16,513
  • 2
  • 52
  • 64
  • another layman question :) then:How do I run it from system d ?(I want to run it from system d but as it did not work out I have asked once more) – ddinc Dec 06 '18 at 13:45
  • Ask a new question and clarify what you want to do ;) Please review https://superuser.com/help/how-to-ask – mtak Dec 06 '18 at 15:17
  • Solved.......... – ddinc Dec 07 '18 at 10:01