Groovyscript as JIRA service does not run

StefanWork February 17, 2016

Hello scripting experts,

I have an example script which shall run as a JIRA service. Code:

def message = "Hello Scriptrunner, this is a Test"
log.info message;
log.debug message;
log.error message;
println message;
return message;

The script is physically existing in the file system.
Executing the file over the "Script Console" works as expected.

Now I created a JIRA service, strictly using the documentation and the FAQ from this board. As schedule I chose "Daily every 15 minutes" because I wanted to see something in the log.

However, the service is not running. In atlassian-jira.log and catalina.out, there is no indication, that it tries to run. Altough I see other services, for example "Git Repository Imports", there is nothing about the Scriptrunner.

My system is a JIRA 7.0.10, Scriptrunner 4.2.0.4 on SLES 11.

What can I do to get the service run regularly?

3 answers

1 accepted

1 vote
Answer accepted
StefanWork February 18, 2016

Hi all,

I found the problem. The hint with "JIRA Data Center" solved the problem. The service is executed either on Node 1 or 2. I found the other executions on the second node.

Thanks for your help.

Yogesh Mude
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.
April 9, 2019

HI @StefanWork 

Could you please let me know the file path how you have been provided in the Admin --> Services.

i have provided as below but it seems not working.

D:/<JIRA_HOME>/scripts/test.groovy

0 votes
StefanWork February 18, 2016

Hi Thanos,

thanks for your reply. Yes, I took the documentation you linked to.

As suggested in https://answers.atlassian.com/questions/181197 I modified my script in Line 1 with

log.setLevel(org.apache.log4j.Level.DEBUG)

For the next run, I took again "Every 15 minutes" in the service-configuration.

Now I can see some executions, but definitely not every 15 minutes. It may execute - but not guaranteed.

 

Here is the example log. The expected run at 9:30 was not logged:

catalina.out.2016-02-18-13-08-41:2016-02-18 09:15:00,118 Caesium-1-3 
ERROR anonymous    Groovy-Sync 
[onresolve.scriptrunner.runner.ScriptRunnerImpl] Hello Scriptrunner, 
this is a Test
catalina.out.2016-02-18-13-08-41:2016-02-18 
09:45:00,157 Caesium-1-3 INFO anonymous    Groovy-Sync 
[onresolve.scriptrunner.runner.ScriptRunnerImpl] Hello Scriptrunner, 
this is a Test

 

Maybe another detail: It's a JIRA Data Center.

0 votes
Thanos Batagiannis [Adaptavist]
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.
February 17, 2016

Hi Stefan

The 'from this board' link is missing so I suppose you mean https://scriptrunner.adaptavist.com/latest/jira/services.html. I can see your script all it does is trying to log a message. You said that you used the same script in script console so does this mean that you actually saw the logs or just the 'return message'. What I am trying to say is, do you have logs for SR enabled ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events