Servers Stop and Start

Hi,
Every time i want to stop and start servers using PuTTY,i have to execute 6 to 10 commands every time ,i need shell script(program) for execute those commands in single command.Is it possible plz suggest me.

Sure is this possible, that's one of the thing shell scripts are good for. Get your favouite editor, vi for example and go! Don't forget to make the shell script executable with "chown" and best give it a suffix like .sh.

Example shell script could look like:

#!/bin/sh

start_apps()
{
     startapp1
     startapp2
     startapp3
}

stop_apps()
{
     stopapp3
     stopapp2
     stopapp1
}


case $1 in
    start)    start_apps;;
    stop)     stop_apps;;
    *)        echo "only start or stop accepted!"
              exit;;
esac

exit 0

Thankq you very much.One more need is i have 4instances for each server so i want to stop or start each instance i need userinterface to enter particular instance name(server name).I am new to unix shell script so tell me how to do it as program.

-------------------------------------------------------------------

With instances I guess you mean database instances of any kind. Maybe it is ok for you to get the environment like this and then start the stuff you have to start:

Example:

...
su - user1 -c "startinst1"
su - user2 -c "startinst2"
...

The environment from the .profile etc. will be taken into account. Also if you don't have to be the user but need the environment, you can also just "source" the environment files for your instances with this:

Example:

. /path/to/environment/file/of/instance1/.profile
. /path/to/environment/file/of/instance1/.special_env

With "env" you can see what is set in your current environment.

Best play around with all this to get a feeling for it.