Linux startup and stop scripts using SSH


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Linux startup and stop scripts using SSH
# 1  
Old 10-25-2017
Linux startup and stop scripts using SSH

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

Each server has two instances :-
abc111 - Masters
-cra4
abc222 -middle tear
-cra
abc333 -middle tear
-cra1
abc444 -middle tear
-cra2
abc555 -middle tear
-cra3

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 tier 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 in parallel for startup and for shutdown. 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: -
Code:
./startup.sh
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 stopscript.sh
Code:
./stopscript.sh 
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 ?

Last edited by rbatte1; 10-26-2017 at 08:46 AM.. Reason: Some formatting, some spelling, some grammar
# 2  
Old 10-25-2017
I'm lost. How do you expect to use ssh to run commands on a server that is not running?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

xsession startup scripts

Can someone please tell me how to run xsession startup scripts whenever I start or after I restart my X session? I'm not trying to do anything fancy I just want this to run. This makes life a lot easier when I use a dual monitor. xrandr --output VGA1 --mode 1024x768 --rate 60 (7 Replies)
Discussion started by: cokedude
7 Replies

2. UNIX for Dummies Questions & Answers

startup script to monitor and stop exim

hi i am a newbie to linux , we use Communigate for our mail on Centos. my problem is how to stop exim from running at startup. If exim starts our users cannot send their mail. i have stopped it running on all run levels but if i check exim status it says : Exim is stopped but the pid is running. ... (4 Replies)
Discussion started by: dongcool
4 Replies

3. AIX

HACMP version 5.4 startup and stop scripts

Hi My hacmp version is 5.4 and it is a active passive cluster. Where can I find the startup and stop scripts? Please assist. Thanks. (2 Replies)
Discussion started by: samsungsamsung
2 Replies

4. UNIX for Dummies Questions & Answers

Startup/Kill Scripts

Hello, I have to perform an audit of a system at work and I am looking at its /etc/rc3.d: K01tog-pegasus K74nscd S08iptables S50openemm K01yum K74ntpd S09isdn S55cups K02NetworkManager K85mdmpd S09pcmcia S55sshd K03rhnsd ... (8 Replies)
Discussion started by: mojoman
8 Replies

5. HP-UX

Startup scripts

Hi all We have HP UX 11.23 installed on 4 RISC servers (2 oracle databases, 2 Oracle App Servers) , we are in a construction period , so the power failure may happen more than once a day. I need to learn how to create an automatic startup services as in Windows, if we know that the services... (5 Replies)
Discussion started by: kafaween
5 Replies

6. Solaris

stop solaris 8 sendmail from running on startup

sorry i got this already... (3 Replies)
Discussion started by: itik
3 Replies

7. Linux

startup scripts (rc3.d)

I've created the following link in order to startup apache tomcat on startup, however, it does not seem to run. Am I missing something out? :confused: /etc/init.d lrwxrwxrwx 1 root root 16 Sep 5 14:59 K73ypbind -> ../init.d/ypbind lrwxrwxrwx 1 root root 16 Sep 11 13:09 S100tomcat ->... (5 Replies)
Discussion started by: jon80
5 Replies

8. Solaris

stop a process to start at system startup

Hi all! I'm running Solaris 10 and have a question about how i can stop a certain program to start at system startup,for example, as it is now sendmail is starting but i don't need sendmail,on the other hand so would i be very glad to get cups up and running at startup, anyone who can explain where... (3 Replies)
Discussion started by: larsgk
3 Replies

9. Shell Programming and Scripting

scripts in another linux m/c via ssh

I want to write a script which connects to another linux via ssh. now i need to execute the rest of my script in that linux.. the echo is coming only when i exited from 10.1.1.252.. pls help (4 Replies)
Discussion started by: esham
4 Replies
Login or Register to Ask a Question