LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-25-2017, 03:08 PM   #1
GlennWerner
LQ Newbie
 
Registered: May 2017
Location: Centereach NY
Posts: 2

Rep: Reputation: Disabled
Question How to call a URL from a Linux script


I am creating a LINUX script that will make an SQLPLUS call to activate a procedure that builds the required URL. The URL is returned in a variable and then I wish to call the URL which will create a file (from a CURL call) on another server while returning either a 200 OK or a 404.
 
Old 05-25-2017, 03:18 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
Your question isn't clear.

You mention "curl" which is the tool I would use for connecting to a URL from a script. Other possibilities are elinks, lynx and wget.

Are you asking how to assign the output of SQL to a variable to be used later (e.g. with "curl $myvar")? If so this link may help:
https://unix.stackexchange.com/quest...ry-to-variable
 
Old 05-25-2017, 03:41 PM   #3
GlennWerner
LQ Newbie
 
Registered: May 2017
Location: Centereach NY
Posts: 2

Original Poster
Rep: Reputation: Disabled
Calling a URL after a PL/SQL call builds it

Sorry,

What is happening is I have an Oracle database I call with a procedure which takes in variables, builds a URL and returns the URL in a variable from the PL/SQL (call it builturl).

I wish, from within the Linux script to call this url, prefer wget if possible.

The URL I am calling is actually a web service which will make a call outside of company and create a data file from the call on another server and then will return to my call (url call if you will) either HTTP 404 or 200 OK.

All of this is then going to be automated using BMC Control - M software.
 
Old 05-25-2017, 07:06 PM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010
Hi Glenn,

Welcome to the LQ forum.

It's kind of cheap, but you could put the URL in a text file and do something like:
Code:
/usr/bin/wget `cat file`
But I don't know off hand the command syntax to make wget put the file in a specific place.

The tick marks mean the output of the command.
 
Old 05-26-2017, 08:57 AM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
You can use Oracle Concurrent Manager to pass variables into scripts. Not sure the exact setup inside Oracle itself but in the script run by concurrent manager (here we name them all with .prog suffix - not sure if that is required or just our convention).

In the .prog you can read in the variables as positional parameters as you can with any other script. The first item passed is $1, the second is $2, the third $3, etc...

In your .prog you'd then want to set less ephemeral variables e.g. if you were passing 2 items into the script you'd do something near the beginning like:
url=$1
othervar=$2

You do that because the positional parameters might be overwritten by other tasks doing output within the script.

You can use your preserved variables later in the script:

wget $url


If you do a web search for "passing parameters concurrent program shell script" you'll find links that will tell you about the Oracle side of it like this one:
http://oracleapplicationstechnicalsc...scripting.html

Last edited by MensaWater; 05-26-2017 at 09:26 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] help bash script to send request to url and re-writing the result url jmishal Programming 3 04-16-2015 04:46 PM
linux machine to call URL through windows machine proxy simhumcon Linux - Newbie 2 08-06-2014 10:02 AM
perl script to parse url from xml URL Freaksta Linux - General 1 01-20-2011 07:46 PM
linux-backtrack- script that call to another script? yogevmi Programming 3 09-17-2010 05:35 AM
How can I script an autologin, automatically call kde(or simillar) and call an app aboaventura Slackware 8 02-03-2007 11:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration