Skip to content

Instantly share code, notes, and snippets.

@bmangesh
Created August 26, 2015 12:23
Show Gist options
  • Save bmangesh/a7b63207ef4ee9d62fed to your computer and use it in GitHub Desktop.
Save bmangesh/a7b63207ef4ee9d62fed to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
if [ $# -lt 2 ]; then
echo 1>&2 "Usage: $0 jobname <fromNum> [<toNum>]"
exit 1
fi
JOBNAME=$1
START=$2
END=$3
BASE_URL="http://somebox/job/${JOBNAME}"
doDelete()
{
if /usr/bin/curl -X POST >/dev/null --silent --fail "${1}/${2}/doDelete"
then
RC=0
echo "$1/$2: deleted"
else
RC=$?
echo "$1/$2: failed: $RC"
fi
return $RC
}
if [ -z "$END" ]; then
doDelete $BASE_URL $START
else
for i in $(seq $START $END); do
echo $BASE_URL/$i/doDelete
doDelete $BASE_URL $i
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment