Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Linux startup and stop scripts using SSH

    I have a question. Actually i want to make two scripts, one is and other is
    so for example,i have 5 servers.

    Each server has two instances :-
    abc111 - Masters
    abc222 -middle tear
    abc333 -middle tear
    abc444 -middle tear
    abc555 -middle tear

    So when starting up a server, first i need to start my masters server first followed by cra4.
    And then the next server, it should be middle tear followed by cra1. Same applies to other servers.
    Basically when starting the servers i should start with masters first den cra4, middle tear first then cra, middle tear first then cra1, middle tear first then cra2, middle tear first then cra3.

    And when stopping the servers, it should be opposite. for example, First i need stop the cra4 then masters, cra then middle tear, cra1 then middle tear, cra2 then middle tear, cra3 then middle tear.

    So now i want to make my scripts to work parellely for startup and for stopdown. I want to make a single scripts through which i can start all the servers one by one and also stop it one by one through SSH.
    And when we execute the startup or shutdown command, it should also ask me like :-
    When we want to start: -
    1) masters
    2) cra
    3) all
    Please enter your choice inorder to start the services :- ?

    Do you want read the logs for each service while startup :- ?
    1) yes
    2) No

    And for
    1. masters
    2. cra

    Please enter your choice in order to stop the services
    1. Stop process
    2. Force kill Process

    Stop type :- ?

    I also need to make a command to see all the running processes.
    ex :- Command "pshow" will lists all the running process.
    So anyone can help me with this please ?

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    What you are describing is an orchestration tool.
    Capistrano comes to mind.

    However, your setup sounds fragile.
    Because sometimes you cannot guarantee the order, ie if a machine fails or needs maintenance.
    You dont want to deal with five machines, just because one needs a harddisc replaced.

    I suggest to look for ways to start the machines independently from each other.
    Even if the services on one machine cannot work without the service of another,
    still start the service and monitor its status.

    On a related note:
    If one service depends on another, then introduce redundancy.
    Last edited by Irithori; 10-26-2017 at 07:25 AM.
    You must always face the curtain with a bow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts