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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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 stop ScriptRunner for Jira script from running

Hi,

I'm using ScriptRunner for Jira for server.

I ran a script from the Script Console to send out emails, and it ran into a loop.  How do I stop the job from running? There is no cancel button in the Script Console.

Help appreciated!

 

Regards,
Marianne

2 answers

2 accepted

1 vote
Answer accepted

Hi Marianne, 

At the moment you cannot stop a script once you have started it. We have an improvement request for this here you can vote for/follow: https://productsupport.adaptavist.com/browse/SRJIRA-3685

For sending emails there is a workaround.

If you put this around the logic that sends an email it should stop it once you disable the outgoing SMTP server:

import com.atlassian.jira.mail.settings.MailSettings

MailSettings mailSettings = ComponentAccessor.getComponent(MailSettings)

if( ! mailSettings?.send()?.disabled) {

//send email logic in here

}else {

log.error("Your outgoing mail server has been disabled")

}


Here is an example of a method that uses this logic if you need to see how it might be used: https://bitbucket.org/snippets/mclark_AV/jeGkLr/send-email-method-example-can-be-used-in

Kind regards,

Katy

Adaptavist Support 

0 votes
Answer accepted

Hi @Marianne Lee _Nagarro_ 

I'm affraid only way to do this i disable and enable scriptrunner again.

Thanks for the reply,  @Tomasz Bryła . I had disabled Outgoing Mail in the server setting, and the mails stopped after another 45min or so.  I'm not sure if that had any effect with the ScriptRunner job.

I suppose disabling / enabling the addon is better than having to restart Jira server which would be the last option.

But I still wonder, if there's any way to abort or interrupt a script while it is running.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Data Center

Introducing Data Center Community licenses

I'm Alison Huselid, Head of Product for Data Center at Atlassian. As we shared in our last post, we’ve been working on a solution for those of you who work for charitable non-profit organizations tha...

769 views 10 45
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