Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the interval for Scheduler to every midnight or every week on Monday or every Month End.

neha March 26, 2018

 I have created some schedulers using following Link.
https://developer.atlassian.com/server/framework/atlassian-sdk/scheduling-events-via-sal-tutorial/

Now I need to run it one of it every Midnight, one every Monday and one to every Month end .  how we can set the scheduler interval to 1 week. or one month I want my scheduler to run every Monday or every month end .

please give me some suggestion on how we can set the scheduler interval to 1 week. or one month or month .

 

Thanks !!

1 answer

0 votes
Maciej Nowakowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 30, 2018

@nehain that case I'd suggest to separate these three as they cannot be formed as one cron expression.

 

You mind find these docs useful: https://docs.atlassian.com/atlassian-scheduler-api/1.5.1/atlassian-scheduler-api/apidocs/com/atlassian/scheduler/config/Schedule.html

neha April 9, 2018

Hi Maciej,

Thanks for the reply. I successfully created the jobs and they are running okay .

I am also creating a user session which has approval and browse rights for all the teams .

I'm getting some exception . I made a scheduler to send emails to all company users if they have unreported hours. Sometimes its working completely okay and some times its giving me error of 401 as my scheduler is making bad request when making rest call for getting required hours and time sheet status for a user.

 

In logs I tried to print the request and respective response which is following:

 

Error occurs when request is :GET localhost/rest/tempo-timesheets/3/timesheet-approval/approval-statuses?&username=neha&periodStartDate=2018-03-01 HTTP/1.1
2018-04-07 13:00:00,329 Caesium-1-1 DEBUG ServiceRunner [c.f.d.integration.api.AbstractHttpClient]

Error occurs when response headers is :

HTTP/1.1 400  mode=block, X-Content-Type-Options: nosniff, X-Frame-Options: SAMEORIGIN, Content-Security-Policy: frame-ancestors 'self', X-Seraph-LoginReason: OK, X-AUSERNAME: lsoufek, Cache-Control: no-cache, no-store, no-transform, Content-Type: application/json;charset=UTF-8, Connection: close, Transfer-Encoding: chunked]
ServiceRunner [c.f.dta.integration.SendEmailToEmployeesImpl] java.lang.RuntimeException: Http response status is: 400

 when i am checking the request from  postman its working fine with this user but in my test server its giving this .

Is X-AUSERNAME response header value should be the name of the logged in user? because its coming different , and in my postman req the x-ausername is coming as logged in user .

But I also have no idea why X-AUSERNAME  is coming different.

Thanks !

Neha 

Suggest an answer

Log in or Sign up to answer