Skip to content

Instantly share code, notes, and snippets.

@Grummfy
Forked from shamil/rundeck_executions_cleanup.sh
Last active September 19, 2019 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grummfy/11289c0c71096d812e9dd59eaf310464 to your computer and use it in GitHub Desktop.
Save Grummfy/11289c0c71096d812e9dd59eaf310464 to your computer and use it in GitHub Desktop.
Rundeck executions cleanup
#!/bin/bash -e
# see related issue: https://github.com/rundeck/rundeck/issues/357
# see https://gist.github.com/Grummfy/11289c0c71096d812e9dd59eaf310464
export PATH=$PATH:~/rd-1.1.0/bin/
# export required vars
export RD_URL=http://localhost:4440 RD_USER=admin RD_PASSWORD=admin RD_HTTP_TIMEOUT=300 RD_PROJECT=mainProject
# make sure rd & jq commands are in the PATH
which -- rd jq >/dev/null
del_executions() {
while true; do
date
rd executions deletebulk -R -y -m ${RD_OPTION_BATCH:-20} --older ${RD_OPTION_OLDER_THAN:-6m} || break
sleep 2s
done
}
# delete executions for each project
for p in $(RD_FORMAT=json rd projects list | jq -r .[]); do
del_executions $p
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment