Sponsored Content
Top Forums Shell Programming and Scripting Curl won't complete in a script but does from prompt. Idea? Post 302993664 by batchenr on Monday 13th of March 2017 09:28:20 AM
Old 03-13-2017
Quote:
Originally Posted by GSalisbury
On RHEL5 from within both a shell (sh->bash) and a csh script curl fails with a "curl: (6) Couldn't resolve host 'application'" error.

This is the result whether run as a command at the shell and/or c-shell prompt and curl also fails with the same error when the scripts are "source'd" at the prompts (".scriptname" at sh prompt; "source scriptname" at csh prompt).

the curl command completes with the "Created" message, however, if it is copied and pasted to the shell or csh prompt. Frustrating! Looking for other reasonable things to try.

This is the curl command:
Code:
curl -i -H "Content-Type: application/json" -X POST -d @CurlData ${CurlAddr}

The "-d @CurlData" file is:
Code:
{
"A":"bbb",
"L":"mmm",
"X":"yyy",
}

The "${CurlAddr}" variable is:
Code:
http://<address>:<port>/A/B/C/post

We've googled around and tried a number of the experiments: removing the space after"Content-Type: "; adding an "Accept: ..." -H Header; having the data expressed on the command-line ( -d '{...}' ); having the address expressed on the command-line.

All combos fail with the "Can't resolve" error from scripts but complete from the prompt.

Has anyone been there before and found a solution?
Thanks.
Geo. Salisbury
Long Valley, NJ
can you update your CURL to latest ?
yum - Upgrade cURL to latest on CentOS - Server Fault
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Limitations of awk? Good idea? Bad idea?

Keeping in mind that I'm relatively comfortable with programming in general but very new to unix and korn/bourne shell scripts.. I'm using awk on a CSV file, and then performing calculations and operations on specific fields within specific records. The CSV file I'm working with has about 600... (2 Replies)
Discussion started by: yongho
2 Replies

2. Shell Programming and Scripting

Script Idea's / Help

Hi there, I'm pretty new to scripting and wondering if anyone had any idea's, scripts or snippets on how I can do the following. I basically want a shell script that will look at all the files in a directory and find all the names and addresses in them then output them to the screen nicely... (12 Replies)
Discussion started by: mrpugster
12 Replies

3. AIX

won't mount /usr...won't boot fully

Hello: NOOB here. I attempted to use smit mkcd. Failed on first attempt, not enough space. 2nd attempt tried to place iso on /usr, not enough space there. Cleanup ran for about 5 minutes after aborting. Now AIX won't boot. LCD display on 7029-6E3 says: 0517 MOUNT /USR. Attempted to boot from CD... (11 Replies)
Discussion started by: bbird
11 Replies

4. UNIX for Dummies Questions & Answers

BASH complete-filename & menu-complete together

Hi, Does anyone know how to make BASH provide a list of possible completions on the first tab, and then start cycling through the possibilites on the next tab? Right now this is what I have in my .bashrc: bind "set show-all-if-ambiguous on" bind \\C-o:menu-complete This allows... (0 Replies)
Discussion started by: Mithu
0 Replies

5. Shell Programming and Scripting

Bash script idea using cUrl -- possible?

I have an alias already in my .bash_profile to download files using cUrl's -o (output to file, user provides the file name) option. I find I'm using it quite a bit, so I wanted to write a script to run "curl -o", taking the necessary inputs - file name and URL from which to download - and then... (3 Replies)
Discussion started by: SilversleevesX
3 Replies

6. Shell Programming and Scripting

need a new idea for a script

Hi all, I now have project in UNIX Solaris and I want to have some new ideas to execute it, so I hope you help me finding new ideas in scripting or some infrastructure .bye (1 Reply)
Discussion started by: hard_revenge
1 Replies

7. HP-UX

File system full, won't complete boot

Hello, I have a very old hp rp2450 running 11i2 that I had to power off. When turning it back on it hangs with the following message. Would booting into SUM get me any further? I've never used SUM, so I'm asking before I go down that rabbit hole. Thanks for the help. # ## extra content... (1 Reply)
Discussion started by: calabaria
1 Replies

8. Shell Programming and Scripting

Access a complete flow with CURL + bash shell

Hello Experts , I have an use case which needed your help . I have been using google for 2 days buy couldn`t succed , i believe i can get the help here. Here is my use case to run on bash shell 1. Access an URL -- in script , it will be mentioned as inputURL 2. Once i accessed the URL... (1 Reply)
Discussion started by: radha254
1 Replies

9. Shell Programming and Scripting

Access a complete flow with CURL + bash shell

Hello Experts , I have an use case which needed your help . I have been using google for 2 days buy couldn`t succed , i believe i can get the help here. Here is my use case to run on bash shell 1. Access an URL -- in script , it will be mentioned as inputURL 2. Once i accessed the URL... (5 Replies)
Discussion started by: radha254
5 Replies

10. UNIX for Beginners Questions & Answers

Bash script won't run because hardware won't produce display

Can anyone offer any advice on how to modify the script below to work on a new system we have, that has no graphics capability? We admin the system through a serial RAS device. I've tried running the below script through the RAS and through an ssh -X session. It failed with something like "GTK... (3 Replies)
Discussion started by: yelirt5
3 Replies
CURLOPT_APPEND(3)					     curl_easy_setopt options						 CURLOPT_APPEND(3)

NAME
CURLOPT_APPEND - enable appending to the remote file SYNOPSIS
#include <curl/curl.h> CURLcode curl_easy_setopt(CURL *handle, CURLOPT_APPEND, long append); DESCRIPTION
A long parameter set to 1 tells the library to append to the remote file instead of overwrite it. This is only useful when uploading to an FTP site. DEFAULT
0 (disabled) PROTOCOLS
FTP EXAMPLE
CURL *curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/to/newfile"); curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); curl_easy_setopt(curl, CURLOPT_APPEND, 1L); curl_easy_perform(curl); } AVAILABILITY
This option was known as CURLOPT_FTPAPPEND up to 7.16.4 RETURN VALUE
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. SEE ALSO
CURLOPT_DIRLISTONLY(3), CURLOPT_RESUME_FROM(3), CURLOPT_UPLOAD(3), libcurl 7.54.0 March 06, 2016 CURLOPT_APPEND(3)
All times are GMT -4. The time now is 10:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy