Scripting in genral?
I need some guidelines to write a shell script that has following problem statement.Please suggest.
Need to write a shell script that will go to list of servers.
Go into the mentioned folders and check for a particular string and ask from the user if he wants to change a occurence with anoter string.
Have you looked at the bash scripting tutorials??
Running an interactive command on another server is going to be a challenge. A tool like puppet or fanout may already do what you're looking for.
My first guideline is to clearly define and state what you really want. Your problem description leaves a lot of gaps. For instance: 'a shell script that will go to list of servers' Go to? What do you mean by 'go to' a server? Make a network connection? What kind of servers? File servers? Web servers? Database servers? Are they on the local host, or out there somewhere on a network?
Another vagary: 'list of servers'. Where is the list? In a file? To be provided from a user? In a shell variable? It is necessary to know this in order for the script to read and parse the list.
You need to recognize that no one reading your description here knows anything whatsoever about the problem. Nothing. Everything has to be spelled out unambiguously. The benefit of doing that will be that it allows you to really think about the elements of the problem in terms that will be part of the solution. So, when someone provides a suggestion, or asks for more information, you will already be thinking in similar terms. It is a bit like the concept that the best way to learn some subject is to teach it. Teach us the details of the problem, and by doing so, start learning about the solution.
Thanks to the theNbomr for that; that is exactly the kind of thing that I had in mind.
You'll be surprised at the extent to which having to state the requirements makes you go through an '...I thought the problem was defined, but now I realise that I have no idea about this aspect..' cycle.
One important aspect that hasn't been mentioned so far is the response of the server: what is intended to happen if a server is down, the network connection is not working or the server only responds slowly? You have to think through the bad stuff that can happen and ensure that you do something sensible (and what qualifies as 'sensible' is heavily dependant on the context stuff that you've spent little time telling us).
|All times are GMT -5. The time now is 10:17 AM.|