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

How to use addShutdownHook with ScriptRunner?

I want to be able to execute a specific action at the end of a script, regardless of the way of termination. That means, even if a script throws an exception, I want to be able to e.g. log a message. In Java, there is addShutdownHook, which also exists in Groovy. This however doesn't work with ScriptRunner, I assume because it is registered with the Jira-process, which is Java too. Seeing how System.exit() terminates the whole Jira instance, I find this likely.

So my question is: How can I register a shutdownhook or achieve my goal in another way if necessary? Please note that wrapping the whole script in a try-catch is not acceptable.

1 answer

Hi @Max Berger Unfortunatelly i dont think there is another possible way besides try catch.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Comparison between Zephyr & Xray

I am sharing this article with both Zephyr and Xray information and everything should be in one place. It will be easy to know when selecting Zephyr or Xray. Zephyr and Xray are both Jira plug-ins u...

180 views 1 5
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