4.4. Scheduling Scripts

The ReportServer scheduler is not only used to schedule reports, but it can also be used to schedule the execution of scripts. To schedule a script use the terminal command scheduleScript. It comes with two commands:

list Lists all scheduled scripts
execute Schedules a new script

To schedule a script you can use natural language expressions. Examples are

scheduleScript execute myScript.groovy " " today at 15:23
scheduleScript execute myScript.groovy " " every day at 15:23
scheduleScript execute myScript.groovy " " at 23.08.2012 15:23
scheduleScript execute myScript.groovy " " every workday at 15:23 starting on 15.03.2011 for 10 times
scheduleScript execute myScript.groovy " " every hour at 23 for 10 times
scheduleScript execute myScript.groovy " " today between 16:00 and 23:00 every 10 minutes
scheduleScript execute myScript.groovy " " every week on monday and wednesday at 23:12 starting on 27.09.2011 until 28.11.2012
scheduleScript execute myScript.groovy " " every month on day 2 at 12:12 starting on 27.09.2011 11:25 for 2 times

The " " (quotation marks) after the script name are the scripts arguments. If we schedule our previous persistentCnt.groovy script we get the following output

scheduleScript execute persistentCnt.groovy " " every hour at 23 for 10 times
Script persistentCnt.groovy scheduled. First execution: 13.12.2013 19:23:00

Via the scheduleScript list command you get an overview of all currently scheduled scripts:

reportserver$ scheduleScript list
id	scriptId	name						next firetime
1		573			persistentCnt.groovy	13.12.2013 19:23:00

To get an overview of the next fire times you can use the scheduler command.

reportserver$ scheduler listFireTimes 1
13.12.2013 19:23:00
13.12.2013 20:23:00
13.12.2013 21:23:00
13.12.2013 22:23:00
13.12.2013 23:23:00
14.12.2013 19:23:00
14.12.2013 20:23:00
14.12.2013 21:23:00
14.12.2013 22:23:00
14.12.2013 23:23:00

Here 1 denotes the schedule entry's id. The scheduler command can also be used for scheduled reports.

To remove an entry you can use the "scheduler remove" command, for example to remove the above entry you need to run

reportserver$ scheduler remove 1