Remove Executions in Rundeck

TL;DR: You have to get the executions’ list and remove the appropriate ones using hte API.

Once we’ve managed to get the list of job executions, we can use the API to remove the relevant executions. The command is rather simple:

This method requires:

  • server – the Rundeck’s server address
  • port – the port on which we can connect to the Rundeck server
  • api_key – the API key
  • execution_ids – an array of valid execution IDs

The function will try to remove all execution IDs in one go, since the API accepts a comma-separated list of executions IDs. In practice, one should build a list of maximum 20-30 items, as removing e.g. 1000 items in one go might time out and block the Rundeck instance until the time out.

Note: You can also remove a single execution:


Normally, the function above is called when the list of execution IDs is built based on some criteria. For example, we can choose to select only the executions older than a number of days. In this case, we can build a function to check agains a date:

where execution date is the timestamp of a specific execution and today is today’s timestamp:

Note: I chose to pass today as a parameter because the script can take days to execute if you have e.g. 300,000+ executions.

function below implements the described logic:

To be more precise, the first loop builds the list ov delete-able executions and the second one remives one BATCH_SIZE at a time.


A little experiment: If you find this post and ad below useful, please check the ad out :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top