LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 10-07-2015, 09:22 AM   #1
kingston
Member
 
Registered: Mar 2008
Location: Bengaluru, India
Distribution: RHEL 5.5, Solaris 5.10
Posts: 215
Blog Entries: 1

Rep: Reputation: 21
Please suggest how to write a bash script to the requirement provided here


Hi Gurus

I have two files as follows

Hosts file:
Code:
dbhost-1
dbhost-2
dbhost-3
dbs file:
Code:
ORATS1
ORATS2
ORATS3
These files are outputs generated from one of my bash script.

Using this file, i have to generate couple of commands as follows
Code:
stop_command -s ORATS1 -u ORATS2,ORATS3 -n dbhost-2,dbhost-3
start_command -s ORATS1 dbhost-2,dbhost-3 ORATS2,ORATS3
Note: Output files will vary as per the DB RAC nodes.
It would be ok, even if you could give an idea on how to start writing to accomplish the task. I feel this is bit complex to get even started.
 
Old 10-07-2015, 09:26 AM   #2
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,163
Blog Entries: 10

Rep: Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979
Show us your script so far please.
 
1 members found this post helpful.
Old 10-07-2015, 11:09 AM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,087
Blog Entries: 10

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
Quote:
Originally Posted by kingston View Post
I feel this is bit complex to get even started.
Code:
#!/bin/sh
Links in my signature cover BASH scripting for Beginners, Advanced Bash Programming, and I have a Blog about Bash Scripting for Dummies.

I would think that you'd understand by this point the need to put in some effort and how to ask an appropriate question.
 
1 members found this post helpful.
Old 10-07-2015, 01:13 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,926

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by kingston View Post
Hi Gurus
I have two files as follows
Hosts file:
Code:
dbhost-1
dbhost-2
dbhost-3
dbs file:
Code:
ORATS1
ORATS2
ORATS3
These files are outputs generated from one of my bash script. Using this file, i have to generate couple of commands as follows
Code:
stop_command -s ORATS1 -u ORATS2,ORATS3 -n dbhost-2,dbhost-3
start_command -s ORATS1 dbhost-2,dbhost-3 ORATS2,ORATS3
Note: Output files will vary as per the DB RAC nodes. It would be ok, even if you could give an idea on how to start writing to accomplish the task. I feel this is bit complex to get even started.
Really??? You've been registered here since 2008, and have been asking about scripting since 2012 at least. That means, for the past THREE YEARS you have been writing scripts. Why is this 'complex' to you, after all that time?
http://www.linuxquestions.org/questi...expect-941259/
http://www.linuxquestions.org/questi...594/page2.html
http://www.linuxquestions.org/questi...ue-4175555326/

Seems like you're asking for a handout.
 
Old 10-07-2015, 01:36 PM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,250

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
I think we need a new section before newbie's such, can't be arsed. That way we can move all the threads where a person doesn't even attempt to try. (sorry ... just getting a little tired of late
seeing this same scenario raise its head time and again)
 
2 members found this post helpful.
Old 10-07-2015, 02:01 PM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,926

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by grail View Post
I think we need a new section before newbie's such, can't be arsed. That way we can move all the threads where a person doesn't even attempt to try. (sorry ... just getting a little tired of late seeing this same scenario raise its head time and again)
Believe me, you're not alone.

I've suggested before that all new threads get moderated before going onto the board. If five or so moderators with limited access took a forum, you'd be left with a manageable number per-moderator. Couple that with a cookie-cutter response, and posts like this would vanish. Just an email to the OP, saying your post didn't meet the criteria stated at <some link>, re-post it when it does.
 
1 members found this post helpful.
Old 10-07-2015, 02:24 PM   #7
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,087
Blog Entries: 10

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
I agree. I was realizing that this is in the Newbie forum, the OP is clearly not new to this and they repeatedly ask questions that are, as said, requests for handouts.
 
Old 10-07-2015, 03:54 PM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,926

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by rtmistler View Post
I agree. I was realizing that this is in the Newbie forum, the OP is clearly not new to this and they repeatedly ask questions that are, as said, requests for handouts.
I never mind a 'newbie' question, and it can be difficult to learn a new language. Simple things can often snakebite you, and syntax can be fussy with some. Posting a script and saying "I keep getting xxx when this runs, and I can't figure this out!" is the way to go. Posting "I need a script to do xxx" is another.
 
Old 10-07-2015, 04:54 PM   #9
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,087
Blog Entries: 10

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
Well I meant that they ought to have put it in Programming.
 
Old 10-08-2015, 01:35 AM   #10
kingston
Member
 
Registered: Mar 2008
Location: Bengaluru, India
Distribution: RHEL 5.5, Solaris 5.10
Posts: 215
Blog Entries: 1

Original Poster
Rep: Reputation: 21
I expected this. With due respect, closing this thread as "Solved"
I will find a way.

Thank you all for your time.
 
Old 10-08-2015, 02:02 AM   #11
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,250

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
kingston - whilst we may have all come down a bit hard on you (for me it has been growing over the last week or so for many and not just you), you should be aware by now that if you show what you have tried then you will get all manner of help from all who have replied here. Unfortunately, your current question reads like :- "I can't be bothered so please do my work for me"

This may not have been your intention, but with over 200 posts under your belt you have been around long enough to know that the members here will give you nothing for free without some effort on your end.

I would note that your signature includes the line, Redhat Certified Engineer, now I find it difficult to believe that you cannot provide any example effort on such an easy problem?
 
2 members found this post helpful.
Old 10-08-2015, 03:15 AM   #12
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Xubuntu, Manjaro
Posts: 745
Blog Entries: 3

Rep: Reputation: 347Reputation: 347Reputation: 347Reputation: 347
Quote:
Originally Posted by grail View Post
if you show what you have tried then you will get all manner of help from all who have replied here
^This++

kingston, you KNOW that we help out. But you gotta start digging yourself first before we pick up our shovels.

Best regards,
HMW
 
1 members found this post helpful.
Old 10-08-2015, 09:39 AM   #13
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,926

Rep: Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690Reputation: 3690
Quote:
Originally Posted by kingston View Post
I expected this. With due respect, closing this thread as "Solved" I will find a way. Thank you all for your time.
With all due respect, that's what you SHOULD have done from the start. If you had, all of us would have been more than happy to try to help you. But asking for handouts after working with scripts for YEARS, isn't going to get you that help.
Quote:
Originally Posted by grail
I would note that your signature includes the line, Redhat Certified Engineer, now I find it difficult to believe that you cannot provide any example effort on such an easy problem?
....which is EXACTLY why I put so little stock in 'certifications'. There are several on this site who ask things like how to add users, write scripts, and how to partition hard drives, just to name a few.
 
1 members found this post helpful.
Old 10-08-2015, 09:50 AM   #14
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Xubuntu, Manjaro
Posts: 745
Blog Entries: 3

Rep: Reputation: 347Reputation: 347Reputation: 347Reputation: 347
Quote:
Originally Posted by TB0ne View Post
....which is EXACTLY why I put so little stock in 'certifications'. There are several on this site who ask things like how to add users, write scripts, and how to partition hard drives, just to name a few.
I want to hug you for writing that. There is WAY too much focus on getting a certification, instead of getting your hands dirty and actually DOING stuff and learning from it.
 
  


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
pls help in my bash script to transfer logs to aws s3,kindly suggest changes... sudi267 Linux - Newbie 1 03-05-2013 09:25 AM
Can somebody write me a bash script trintukaz Programming 9 09-26-2011 04:02 PM
Trying to write a bash script christianunix Linux - Newbie 5 10-26-2007 06:30 PM
Suggest me Best Distro according to my Requirement rudraansh Linux - Distributions 3 11-22-2006 08:27 PM
Need to write a bash script imagineers7 Linux - General 5 05-10-2006 12:17 AM


All times are GMT -5. The time now is 06:51 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration