use varnish 6 ban command
This commit is contained in:
parent
2c6a0db863
commit
c4fa529183
2 changed files with 1 additions and 63 deletions
|
|
@ -1,62 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Author: Oliver Ladner <oli@lugh.ch>
|
||||
# License: LGPL
|
||||
#
|
||||
# Cleans directories from garbage files
|
||||
|
||||
# Where to look
|
||||
DIR="/mnt/dir1 /mnt/dir2"
|
||||
# Garbage files (do NOT add desktop.ini/thumbs.db)
|
||||
# Example to delete every WMV-file:
|
||||
#HATED_FILES=' -o -iname '*.wmv' '
|
||||
|
||||
HATED_FILES=' -o -iname '.DS_Store' -o -iname '*.url' '
|
||||
|
||||
# Locate dirs/files with setUID
|
||||
#echo -n "Looking for setUID dirs in $DIR..."
|
||||
#COUNT_SUID=`find $DIR -type d -perm -u=s -print | wc -l`
|
||||
#
|
||||
#if [ "$COUNT_SUID" -eq 0 ]; then
|
||||
# echo " OK, no setUID directories found"
|
||||
#else
|
||||
# echo " Found $COUNT_SUID directories"
|
||||
# echo -n "Doing 'chmod -R u-s'..."
|
||||
# # Remove the setUID bit
|
||||
# find $DIR -type d -perm -u=s -exec chmod -R u-s {} \;
|
||||
# if [ ! "$?" -eq 0 ]; then
|
||||
# echo " ERROR while chmodding"
|
||||
# exit 1
|
||||
# else
|
||||
# echo " OK"
|
||||
# fi
|
||||
#fi
|
||||
|
||||
# FIXME: add search for dirs/files with weird names
|
||||
#find $DIR -maxdepth 100 -type d -print | grep '?'
|
||||
|
||||
# Get rid of files like Thumbs.db and desktop.ini,
|
||||
echo -n "Searching garbage files..."
|
||||
find $DIR \( -iname 'desktop.ini' -o -iname 'thumbs.db' $HATED_FILES \) -print > /tmp/cleanup.$$
|
||||
if [ $? -gt 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $(grep -v -c '^$' /tmp/cleanup.$$) -eq 0 ]; then
|
||||
echo " OK, no garbage files found"
|
||||
else
|
||||
echo " Found $(grep -v -c '^$' /tmp/cleanup.$$) garbage files"
|
||||
echo -n "Doing 'rm -f'..."
|
||||
# Search again and delete the crap
|
||||
cat /tmp/cleanup.$$ | while read LINE; do
|
||||
rm "$LINE"
|
||||
if [ ! "$?" -eq 0 ]; then
|
||||
echo " ERROR while deleting garbage file $i"
|
||||
RC=1
|
||||
else
|
||||
RC=0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
rm /tmp/cleanup.$$
|
||||
exit $RC
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# Ban (purge) all on localhost
|
||||
|
||||
# Varnish 4
|
||||
varnishadm -T localhost:6082 -S /etc/varnish/secret "ban req.http.host ~ $1"
|
||||
#varnishadm -T localhost:6082 -S /etc/varnish/secret "ban req.http.host ~ $1"
|
||||
|
||||
# Varnish 5
|
||||
varnishadm -T localhost:6082 -S /etc/varnish/secret ban req.http.host == $1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue