Skip to content

Instantly share code, notes, and snippets.

@shamil
Last active August 7, 2024 17:44
Show Gist options
  • Select an option

  • Save shamil/1f6524f06210252c7d13d0deb169bdc2 to your computer and use it in GitHub Desktop.

Select an option

Save shamil/1f6524f06210252c7d13d0deb169bdc2 to your computer and use it in GitHub Desktop.

Revisions

  1. shamil revised this gist May 29, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rundeck_executions_cleanup.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ del_executions() {
    local project=$1

    while true; do
    rd executions deletebulk -y -m ${RD_OPTION_BATCH:-20} --older ${RD_OPTION_OLDER_THAN:-3d} -p $project || break
    rd executions deletebulk -R -y -m ${RD_OPTION_BATCH:-20} --older ${RD_OPTION_OLDER_THAN:-3d} -p $project || break
    sleep 1s
    done
    }
  2. shamil created this gist Nov 5, 2017.
    24 changes: 24 additions & 0 deletions rundeck_executions_cleanup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    #!/bin/bash -e
    # see related issue: https://github.com/rundeck/rundeck/issues/357

    # export required vars
    export RD_URL=http://localhost:4440 RD_USER=admin RD_PASSWORD=admin RD_HTTP_TIMEOUT=300

    # make sure rd & jq commands are in the PATH
    which -- rd jq >/dev/null

    del_executions() {
    local project=$1

    while true; do
    rd executions deletebulk -y -m ${RD_OPTION_BATCH:-20} --older ${RD_OPTION_OLDER_THAN:-3d} -p $project || break
    sleep 1s
    done
    }

    # delete executions for each project
    for p in $(RD_FORMAT=json rd projects list | jq -r .[]); do
    del_executions $p
    done

    exit 0