LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-15-2012, 02:36 AM   #1
Milchknilch
LQ Newbie
 
Registered: Mar 2011
Posts: 6

Rep: Reputation: 0
bash: open url command (and ignore error)


Hi,

I'm running a bash script via Jenkins CI and want to open an url
http://server.whats.itl:4444/seleniu...SeleniumServer
to shut down selenium server.

My first intention was to use "wget --remove-after" with > /dev/null 2>&1, but in case the server is not running, the build fails.

I hope someone could tell me a more suitable command than wget (this can't be so hard, but it seems like I'm searching for the wrong terms) and then maybe I can figure out a way how to deal with the error.
 
Old 03-15-2012, 02:41 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

If your wget command works when the server is running, then you could include it in an if condition to check first if the server is available, for example checking the ip : port combination. If the server is up, it would be shut down by the command and if it's not up then the build would continue.

Kind regards,

Eric
 
1 members found this post helpful.
Old 03-15-2012, 04:55 AM   #3
Milchknilch
LQ Newbie
 
Registered: Mar 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Thank you for your suggestion, but I think I now found a solution that is a little bit less complicated than checking availability first:

curl -f --connect-timeout 3 http://dingenskirchen.org:4444/selen...SeleniumServer || :

Even with "-f" option I got some output from curl and to prevent the Jenkins script fail on errors I used the "|| :"
 
Old 03-15-2012, 04:56 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

Nice catch! If you consider your problem solved, then please mark the thread as such.

Kind regards,

Eric
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script: Move files, ignore case Fredde87 Linux - Software 3 09-03-2008 03:34 AM
BASH command for open file phantom_cyph Linux - General 16 03-26-2007 10:26 PM
cp command: except or ignore option? C-RAF. Programming 9 02-28-2006 03:23 AM
ERROR The requested URL could not be retrieved While trying to retrieve the URL: /re Niceman2005 Linux - General 1 06-29-2005 09:51 AM
bash script - open new window running a command zippity Linux - Newbie 1 07-13-2004 11:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:07 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