The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to write a Shell Scripting to know the services running or not in linux

cmbollareddy
Contributor
November 11, 2019

Hi, 

How to write a Shell Scripting to know the services running or not in linux. 

Ex: If service is stopped automatically get the mail notification "JIRA Service has stopped". 

after wrote the scripting by using shell and Where to keep the scripting file in JIRA. 

 

 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Leo
Community Champion
November 11, 2019

Hi @cmbollareddy ,

I'm not sure it answers your question or not.but you can try this out

the below rest api will give you the status of your confluence/jira service: BASE-URL/status

you can include this in your shell script and based on the result trigger mail

To check periodically set a cron job for the same

200

{"state":"RUNNING"}

Running normally

500 

{"state":"ERROR"}

An error state

503

{"state":"STARTING"}

Application is starting

503

{"state":"STOPPING"}

Application is stopping

200

{"state":"FIRST_RUN"}

Application is running for the first time and has not yet been configured

404

 

Application failed to start up in an unexpected way (the web application failed to deploy)

 

BR,

Leo

cmbollareddy
Contributor
November 11, 2019

I don't want to check jira service status in browser. 

I need shell scripting..if service is stopped then automatically recevied an email. 

Derek Fields _RightStar_
Community Champion
November 11, 2019

You can do this using curl. 

curl http://localhost:8080/status | grep RUNNING > /dev/nul
[ $? -eq 0 ] && echo "Running" || echo "Error"

Obviously, you would do something other than echo based on success or failure