You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
652 B
26 lines
652 B
2 years ago
|
#!/bin/bash
|
||
|
|
||
|
if ! [ -f ~/.cloudflarerc ] ; then
|
||
|
echo "No ~/.cloudflarerc file found. Cloudflare clear cache SKIPPED."
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
. ~/.cloudflarerc
|
||
|
|
||
|
echo -n "Clearing cloudflare cache..."
|
||
|
|
||
|
ret="$(curl -s -X DELETE "https://api.cloudflare.com/client/v4/zones/$id/purge_cache" \
|
||
|
-H "Authorization: Bearer $apikey" \
|
||
|
-H "Content-Type: application/json" \
|
||
|
--data '{"purge_everything":true}')"
|
||
|
|
||
|
if [ -n "$(echo $ret | grep success)" ] ; then
|
||
|
echo " Success!"
|
||
|
else
|
||
|
echo " *** FAILED ***"
|
||
|
echo "Could not clear cloudflare's cache. Update will not proceed."
|
||
|
# exit with 1, so the update does not proceed, so we will know
|
||
|
exit 1
|
||
|
fi
|
||
|
|