Scriptrunner Listener "Jira just started" event

Daniel Garcia September 1, 2024

I want to run a script each time Jira starts. I can't seem to find a "Jira just started" event but it there another event that reliably runs on startup ?

2 answers

1 accepted

0 votes
Answer accepted
Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 2, 2024

The thing is, you can't really catch a "Jira just started" as an event - because plugins get initialized in the "I'm online" status - so a plugin never really knows when Jira has or hasn't started.

When Jira starts up it will start waking up the plugins, so once the plugin has loaded, technically it would be "on startup", however, you could also just re-enable the plugin, or update it, and the same thing happens.

What you're after is more appropriate on OS level, but since you haven't said why you're interested in it, we don't know.

 

Maybe you might be able to figure out a workaround like getting the process uptime from OS and then evaluating in code whether it means a startup or not, or maybe there is some sort of an "uptime tracker" in Jira, maybe you could talk to the underlying OS and ask it stuff, or you could pass a jvm arg with startup timestamp each time you start/restart the process, so you could read it from the code and have a timestamp to work with to evaluate it, but all in all, not an event as far as I'm aware, at best - hacky workarounds.

Daniel Garcia September 9, 2024

I guess I could have a job that runs often and read uptime. Maybe it could set a "lastRuntAt" property to ensure it runs just once.

0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 2, 2024

Hi @Daniel Garcia ,

for my knowledge listener is at issue level so you can intercept event per issue basis and not for jira instance.

Hope this helps,

Fabio

Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 2, 2024

No, Jira throws events about virtually everything left and right. Issue events are just one small section of it.

Suggest an answer

Log in or Sign up to answer