Sponsored Content
Top Forums Shell Programming and Scripting Curl/http 503 error with bash script Post 303008602 by kieranfoley on Monday 4th of December 2017 07:23:28 AM
Old 12-04-2017
Hi RudiC,

I'm not sure what you mean? The LINK variable is defined from this line in the script.

Code:
LINK=`cat $TEMP_DIR/test_xml.out | grep link | sed 's/<link>//g;s/<\/link>//g'| awk '{sub(/^[ \t]+/, ""); print}'`

Once the script finishes running (albeit with the 503 service available error) I am able to define the LINK variable from the command line and run the curl GET using $LINK or using the variables contents - either way it works when I run it outside of the script.

If I echo the $LINK variable within the script to get it's contents it is what I expect it to be.
 

10 More Discussions You Might Find Interesting

1. 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

2. UNIX for Advanced & Expert Users

Issue in Curl to send http POST request with attachment/multipart

Hi, I am using curl to hit a url using http in solaris 10 using commandline, I want to transfer an attachment(using multipart curl -F) also as a part of the request. If anyone has used kindly help me with the syntax. I am using below command: Code: /usr/local/bin/curl -v... (1 Reply)
Discussion started by: manishmaha
1 Replies

3. Shell Programming and Scripting

bash curl escape & in url

I'm running a curl command in bash, but the & in the middle causes the second half of the line to run in the background, here's what I'm trying to do: lat="37.451" lon="-122.18" url="http://ws.geonames.org/findNearestAddress?lat=$lat&lng=$lon" curl -s "$url" I tried escaping the & with \&,... (4 Replies)
Discussion started by: unclecameron
4 Replies

4. UNIX for Advanced & Expert Users

Syntax issue in curl for getting a file from http site

Hi All I am using curl in my client environment. We need to pull a file from the libraries site. All the files are having perticular URL which can be used to get the files. Only issue is, when we fire that command , it will take to authentication page 1st. once authentication is succed, it will... (1 Reply)
Discussion started by: prabirkumardhar
1 Replies

5. Linux

Apt-get update wont run and gives 503 service unavailable error

Hi, I am running on Ubuntu 12 (precise) 64 bit and came to know that i cannot install any packages using apt-get and aptitude. Linux test01 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux But the same /etc/apt/sources.list file is... (20 Replies)
Discussion started by: prash358
20 Replies

6. Shell Programming and Scripting

Sending awk variables into curl in a bash script

Hello experts! I have a file1 with the following format (yr,day, month, hour,minute): 201201132435 201202141210 201304132030 201410100110 ... What i want to do is to assign variables and then use them in the curl command to download the text of each event from a web page. What I have... (6 Replies)
Discussion started by: phaethon
6 Replies

7. Shell Programming and Scripting

awk script to find time difference between HTTP PUT and HTTP DELETE requests in access.log

Hi, I'm trying to write a script to determine the time gap between HTTP PUT and HTTP DELETE requests in the HTTP Servers access log. Normally client will do HTTP PUT to push content e.g. file_1.txt and 21 seconds later it will do HTTP DELETE, but sometimes the time varies causing some issues... (3 Replies)
Discussion started by: Juha
3 Replies

8. Shell Programming and Scripting

Using curl in bash script

Hello. I have pick up a script from internet to track errors from curl command. #!/bin/bash # URL_TO_TEST="http://www.xxxxxx.yyy" MY_VAR=curl_init("$URL_TO_TEST") ; curl_setopt($MY_VAR, CURLOPT_HEADER, 1); curl_setopt($MY_VAR, CURLOPT_RETURNTRANSFER, 1); curl_setopt($MY_VAR,... (2 Replies)
Discussion started by: jcdole
2 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. Shell Programming and Scripting

Curl , download file with user:pass in bash script

Hello, My question is about curl command. (ubuntu14.04) In terminal, I am able to download my mainfile with: curl -u user1:pass1 http://11.22.33.44/******* When I convert it into bash script like this: #!/bin/bash cd /root/scripts computer_ip=11.22.33.44 curl -u $1:$2... (8 Replies)
Discussion started by: baris35
8 Replies
CURLOPT_HEADER(3)					     curl_easy_setopt options						 CURLOPT_HEADER(3)

NAME
CURLOPT_HEADER - pass headers to the data stream SYNOPSIS
#include <curl/curl.h> CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADER, long onoff); DESCRIPTION
Pass in onoff set to 1 to tell the library to include the header in the body output for requests with this handle. This option is relevant for protocols that actually have headers or other meta-data (like HTTP and FTP). When asking to get the header info passed to the same callback as the body, it is not possible to accurately separate them again without detailed knowledge about the protocol in use. It is often better to use CURLOPT_HEADERFUNCTION(3) to get the header data separately. While named confusingly similar, CURLOPT_HTTPHEADER(3) is used to set custom HTTP headers! DEFAULT
0 PROTOCOLS
Most EXAMPLE
CURL *curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); curl_easy_setopt(curl, CURLOPT_HEADER, 1L); curl_easy_perform(curl); } RETURN VALUE
Returns CURLE_OK. SEE ALSO
CURLOPT_HEADERFUNCTION(3), CURLOPT_HTTPHEADER(3), libcurl 7.54.0 February 03, 2016 CURLOPT_HEADER(3)
All times are GMT -4. The time now is 03:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy