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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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

Suggest an answer

Log in or Sign up to answer
0 votes
Alejandro Suárez - TecnoFor
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
Nov 09, 2019

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

AUG Leaders

Atlassian Community Events