How do I setup a Jelly-script scheduled service to run once a day on weekdays only

How do I setup a Jelly-script scheduled service to run once a day on weekdays only?

I have a script that gets the results of a pre-defined filter (issues which need immediate attention) and adds a comment which in turn will email the assignee as a reminder...

The only problem is that this runs every day, including weekends... In this day and age with smart phones, our developers don't want to be hassled on weekends (understandably)....

How can I setup a weekday schedule for a service runner?

Alternatively, is there a way that a filter returns no issues if run on a weekend? This would also stop the spam....

1 answer

1 accepted

0 votes
Accepted answer
David Currie Atlassian Team Jul 03, 2012

Hey Chris,

if you would like to schedule services to run against JIRA with something like cron, I'd highly recommend using the APIs to run these tasks in JIRA rather than using Jelly Tags. You could, for example:

  • Have a shell script use the REST API to work through the required tasks.
  • Use the JIRA Command Line Interface. This does use the SOAP API, which is being deprecated so may not be the best solution for future-proofing. There may be future development for the CLI to use the REST API which I'm not aware of, however.

There's also a New Feature request to have better time handling implemented into the services within JIRA, under JRA-1865 - please vote and watch on that issue if you're interested in it.


Dave

Hi Dave,

I have been reading about REST and bashing my head against a wall trying to get something to work, I have been trying to use curl on the command line and all it does is throw errors, either bash errors or http errors... Here is a sample attempt

curl -D- -u administrator:administrator -X POST --data "{"jql": "status=Open", "startAt": "0", "maxResults": "50", "fields": ["key","summary"]}" -H "Content-Type: application/json" http://127.0.0.1:8080/rest/api/2/search/
<br< a="">>

Now if I get something to work, what do I do with the results? How do I loop through all the returned values and add comments or change data in each issue?

Thanks

Chris

David Currie Atlassian Team Jul 04, 2012

Hey Chris,

The easier path would probably be using the JIRA CLI - this is a whole set of scripts designed to use the SOAP API rather than writing one to target REST as required. Bob may be updating them to use REST.

Otherwise, first I'd recommend testing the REST calls with something like the REST Console in Chrome. This will help you isolate whether or not the REST call or the command line is causing the problem. As for going through the returned values, you'd need a wrapper script to parse the JSON. You could do it with Perl - here are some examples that should help:

Hope that helps! :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,808 views 18 22
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you