Skip to content

Instantly share code, notes, and snippets.

@krzysbaranski
Created November 8, 2019 17:02
Show Gist options
  • Save krzysbaranski/29888dc9c5bdbea8fbf3e8546c187a5b to your computer and use it in GitHub Desktop.
Save krzysbaranski/29888dc9c5bdbea8fbf3e8546c187a5b to your computer and use it in GitHub Desktop.
rundeck delete bulk
#!/bin/bash
export RD_URL='http://localhost:4440'
export RD_TOKEN="@option.rundeck_token@"
export CURRENT_DATE=$(date -u -d now "+%Y-%m-%d %H:%M:%S")
echo "Bulk delete of executions for frequent jobs"
for run in {1..5}
do
echo "deleting jobs older than 14 days - iteration ${run}"
rd executions deletebulk --project="RundeckProject" --status=succeeded -J --max=200 --older=14d -y || /bin/true
done
echo "########## frequent jobs cleanup ################"
JOB_NAME="job1"
echo "##### ${JOB_NAME} ######"
for run in {1..5}
do
echo "deleting jobs from ${JOB_NAME} iteration ${run}"
rd executions deletebulk --project="RundeckProject" --status=succeeded --nameexact "${JOB_NAME}" -J --max=200 --older=4d -y || /bin/true
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment