Forked from shamil/rundeck_executions_cleanup.sh
Last active
September 19, 2019 09:36
-
-
Save Grummfy/11289c0c71096d812e9dd59eaf310464 to your computer and use it in GitHub Desktop.
Rundeck executions cleanup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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