admin管理员组

文章数量:1124021

right now I am running B2Bi Stop and B2B Start script separately. B2Bi is the name of my application. if I get the B2Bi restart script then I will not stop and start separately. I want to write a single script like below:

Stop (./B2Bi stop)
Check Status(./B2Bi status)
If not stopped yet sleep 30 Sec
Check Status again
If not Stopped yet sleep 30 Sec
Check Status again
If not Stopped yet then Exit
Else start(./B2Bi start)
--------------
Usage: B2Bi [commands]


Commands include:
start, Starts B2Bi in the background.


stop, Stops B2Bi.



status, Displays whether B2Bi is running or
stopped.
the output of status command as below
./B2Bi status

"There are 4 active nodes
awsu1-07lawa01q_te: Started
awsu1-07lawa01q_b2b: Started
awsu1-07lawa01q_cn: Started
awsu1-07lawa01q_rest: Started

Interchange status is : running"

OR

"There are 4 active nodes
awsu1-07lawa01q_te: Stopped
awsu1-07lawa01q_b2b: Stopped
awsu1-07lawa01q_cn: Stopped
awsu1-07lawa01q_rest: Stopped

Interchange status is : stop"

I need to grep for "Stopped" string in B2Bi Status, if stopped string found then run the next Start command else what to 30 Sec to re-check

i need the shell script

本文标签: how to code shell script to perform custom restartStack Overflow