3

This is a script that checks my current ip on this site: http://myip.dnsdynamic.org/ and pick the response and calls an API in order to update my dynamic ip.

Here the script:

curl --user <myusername>:<mypasswd> https://www.dnsdynamic.org/api/?hostname=eventsonmap.ssh22.com&myip=`curl http://myip.dnsdynamic.org/`

When i run it it's all ok but the command stops and doesn't return normally it works only if at the end i press ENTER or ctrl+c what i'm doing wrong? I'm missing a param?

This script is a cronjob that run every minyte so i can't press ENTER

More info

Here on pastebin the full result of the curl -v <same> here the last 2 lines:

* Closing connection 0
* SSLv3, TLS alert, Client hello (1):

and blocks here...

francescop
  • 41
  • 1
  • 3

1 Answers1

3

Some of the characters in your command are shell meta-characters. You are effectively starting one task in the background.

You need to quote your command. I've re-ordered the command since its a big ugly.

myip=$(curl "http://myip.dnsdynamic.org/")
curl --user <myusername>:<mypasswd> "https://www.dnsdynamic.org/api/?hostname=eventsonmap.ssh22.com&myip=${myip}"`
Matthew Ife
  • 22,927
  • 2
  • 54
  • 71