Skip to content

Instantly share code, notes, and snippets.

@amirulasyraf88
Forked from nawawi/purge-all.sh
Created August 25, 2019 17:03
Show Gist options
  • Save amirulasyraf88/147a49492388f1dda8aab35065909e48 to your computer and use it in GitHub Desktop.
Save amirulasyraf88/147a49492388f1dda8aab35065909e48 to your computer and use it in GitHub Desktop.
#!/bin/bash
# please refer to https://github.com/nawawi/nginx-cache-data/blob/master/nginx-proxy-cache-data.sh
cat /tmp/nginx-proxy-cache-data/data-file-cache.txt |grep -v ^# |tr -s '|' ' ' |while read _host _size _url; do
_purge="$(echo $_url|sed -e "s/$_host/${_host}\/purge/g")";
_output="$(curl -s -H "Host: ${_host}" ${_purge}*)";
echo $_output;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment