Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

restart JIRA Services in windows(RD/VM) using script/rEST API/automatically

Team,

i am looking for a solution where by receiving an intake request (JSD) and by clicking approve tab, the JIRA services in Windows (RD/VM) should restart automatically.

Please share if any script/Rest api/kb to implement solution

Thanks in advance   

1 answer

1 accepted

0 votes
Answer accepted
Daniel Eads Atlassian Team Oct 02, 2020

Hi Srikanth,

I'm not totally sure if you're trying to restart the running Jira instance. That wouldn't make a lot of sense to me - because if Jira were stuck and needing its service restarted, you wouldn't be able to approve a request.

Instead I'm going to assume a more generic question: "Can Jira be configured to make system calls?"

With the way Jira's plugin system is set up, you don't really escape the Java virtual machine to do things (like restarting services) on the host operating system. Some apps like Scriptrunner do allow you to fire webhooks to other services. So I suppose it's possible you could have "some other service" running, which would listen for a webhook and then trigger a service restart as you needed it via standard Windows commands - most likely a Powershell script. But that does feel like a massive security issue - if Jira can trigger a webhook to that script/service, it would take significant effort to ensure nobody else could nefariously use the same mechanism to restart services whenever they wanted.

Instead of going that route, I'd suggest looking into products that are designed to monitor and restart services. A quick search turned up ServiceKeeper as a viable-looking option, although others certainly exist.

Cheers,

Daniel

Hi Daniel,

Thanks for your reply.

Let me give more focus on requirement.

Environment :Windows

1. Team noticed that Jira is down on Host/VM for what ever reason.

2. Prod owner raises a JSD request and assigned to JIRA admin team.

3. Jira lead/manager review the request and click on Approve tab on request.

(ideally we should log into host and start JIRA Services manually) 

4. clicking approve  action  will connect to host and start the  JIRA services  automatically and collect indexing details from server.

Here in approve status we are looking  for a mechanism which will handle below functionality

1. it should connect to host 

2. Look for JIRA services on host and restart the services.

3. Collect index details from server

4. Exit from host securely 

Hope it is more clear 

Kindly let me know if any information you are looking 

Thank you in advance 

Daniel Eads Atlassian Team Oct 05, 2020

Thanks for the additional context. I think the above answer still applies - Jira plugins aren't going to escape the Java VM to make the kinds of calls you'd need to securely restart a Windows service. You'd need another service somewhere in the mix to receive an API call and get down to the WMI/Powershell level.

In addition to that fundamental limitation, considering why Jira is not running is an issue that doesn't seem to be highly addressed in that scenario. It shouldn't be expected that Jira will just randomly shut itself off. If the service is crashing frequently, the underlying causes should be investigated and remedied. Restarting the service without examining the other conditions on the VM, looking at log files, checking for out of memory conditions, etc - that's just putting a bandage on the situation but inviting the service to shut down again in the future.

I hope that helps with your question (the answer is no: Jira doesn't have a way to do this) and provide some context on other considerations. You'll need to have some other software in the mix for this, and should consider spending more time on finding out why Jira isn't running on the system in question.

Thank you Daniel for further detailed clarification. 

Hi Daniel

 Before conclusion , any Rest api is available to restart Jira services in VM/RD (windows)  and collect sever indexing details. We are running Data Center.

Thanks in advance 

Daniel Eads Atlassian Team Oct 09, 2020

There's no REST API endpoints for restarting the application - typically you would only do this if it were locked up, so having the application try and respond to a call to restart itself when it's not able to answer calls normally would not make much sense. Restarting the application should be handled at the operating system level. I would again point to other applications such as ServiceKeeper or its like to manage the Windows services for you.

In terms of indexing - if you mean the search index for issues, there is a REST API to trigger a re-index. Please see Reindex Jira server using REST API via cURL command for information on that, and there's also a /status endpoint you can check to get healthcheck details about the DC node:

  • No Johnson event, or a Johnson event which doesn't prevent startup: 200, "STARTING"/"FIRST_RUN"/"RUNNING"
  • Startup is delayed by a reIndexing event, and nothing else: 503, "MAINTENANCE"
  • Startup is prevented by a different Johnson event: 500, "ERROR"

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

620 views 7 23
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you