Skip to content

Instantly share code, notes, and snippets.

@Duologic
Created January 22, 2018 16:08
Show Gist options
  • Save Duologic/7d2660f4513b1788301a20b42ea4670f to your computer and use it in GitHub Desktop.
Save Duologic/7d2660f4513b1788301a20b42ea4670f to your computer and use it in GitHub Desktop.
Delete Rundeck jobs
#!/bin/bash
# ./delete_rundeck_jobs.sh <token> <project>
set -euo pipefail
IFS=$'\n\t'
JOBS=$(curl -s -X GET \
-H"X-Rundeck-Auth-Token: $1" \
-H"Accept: application/json" \
"http://rundeck.example:4440/api/19/project/$2/jobs" | jq .[].id | tr -d '"')
for j in $JOBS; do
curl -s -X DELETE \
-H"X-Rundeck-Auth-Token: $1" \
"http://rundeck.example:4440/api/19/job/$j"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment