yum install jq # should be in epel
for href in `curl "https://$(hostname)/pulp/api/v3/tasks/?state=running&state=waiting" --cert /etc/pki/katello/certs/pulp-client.crt --key /etc/pki/katello/private/pulp-client.key | jq '.results[].pulp_href' | awk -F '"' '{print $2}'`; do echo "https://$(hostname)$href" ; curl "https://$(hostname)$href" -X PATCH -d '{"state": "canceled"}' -H "Content-Type: application/json" --cert /etc/pki/katello/certs/pulp-client.crt --key /etc/pki/katello/private/pulp-client.key ; done