Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Can any one explain, what does "hostname -f" say in curl command?

avatar
Expert Contributor

curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari'-X PUT -d '{"RequestInfo": {"context" :"Start HDFS via REST"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}' http://`hostname -f`:8080/api/v1/clusters/$CLUSTER_NAME/services/HDFS In the above curl command, what is the meaning for "hostname -f". I am new to usage of REST APIs, it may be a stupid question. I would like to get clear idea for the above command.

1 ACCEPTED SOLUTION

avatar
Super Collaborator

The back ticks around the text cause the command to execute and the output is put in place of the command text. So you get the fully qualified hostname of the machine where the command is being executed placed into the command. If you run this snippet from a shell that is not on the Ambari server, you will get an error because the command is being sent to the local machine.

View solution in original post

5 REPLIES 5

avatar
Master Mentor

it means fully qualified domain name of the host. I think it was just to explain that full FQDN goes in the URL. I don't think it works as valid curl command as is but I've been surprised before @Ram D

avatar
Master Mentor

@Ram D where did you get this example?

avatar
Expert Contributor

avatar
Master Mentor

@Ram D I think Terry answered it best.

avatar
Super Collaborator

The back ticks around the text cause the command to execute and the output is put in place of the command text. So you get the fully qualified hostname of the machine where the command is being executed placed into the command. If you run this snippet from a shell that is not on the Ambari server, you will get an error because the command is being sent to the local machine.