Getting Started

Features

Configuration

What is it?

Script Jobs allows you to run code at specific times of the day/week/month on an specific interval.

Why use it?

Script Jobs allows you to automate Confluence, saving a huge amount of time and ensuring your instance is well maintained.

For example you could use Script Jobs to archive pages after a certain amount of time has passed and no edits have occurred, keeping your content fresh.

How to use it?

  • Select the Script Jobs tab in the ScriptRunner menu

  • Provide a name for your script job

  • Select if you want to run this task as yourself or the ScriptRunner Add-on user. Script Listeners can make requests back to Confluence using either the ScriptRunner Add-on user or the user that performed the action to cause the event to be fired. This is useful if you want specific actions (e.g: creating a page) to have the creator as being the current user or a generic ScriptRunner Add-on user

  • Select the schedule that you want this script to run

    • The schedule editor dialog lets you choose between running your script on several days during the week (e.g. Monday, Wednesday, Friday), or running your script on particular days of the month (e.g. the last day of the month, the 2nd Tuesday of the month)

    • Additionally you can select an hour interval during which your script will be run

  • Add your script

Note - ScriptRunner has a number of example scripts that you can use or update to fit your needs

  • Select save

  • You can also choose to run the script immediately

The minimum interval between code executions is 1 hour. The scheduler is triggered every hour and gathers all the tasks to be executed within that hour. The task executions are queued and workers will consume them in no predefined order. That means that the execution time of the task can not be guaranteed to be the same every hour. As an example: if you configure a job to be run every hour, it might be run at 01:02 and then 02:24 and then 03:00 and then at 04:46 etc depending on how busy our systems are.

Examples

Delete old comments

What does it do?

Delete comments that are older than a certain amount of time.

Why should you use it?

It makes comments easier to view and content more manageable.

Table View

Add a comment to old pages

What does it do?

Add a label to old pages to say that they should be reviewed.

Why should you use it?

It allows for users to easily see if content is fresh. It also helps to better signpost where a piece of content is in its lifecycle.

Table View

Delete old page versions

What does it do?

Delete versions that are older than a certain amount of time.

Why should you use it?

It makes content more manageable.

Table View