forked from mirrors/akkoma
Add sudo rule, remove quoting that breaks the for loop
This commit is contained in:
parent
0b19534475
commit
8373cb645b
1 changed files with 7 additions and 3 deletions
|
@ -1,6 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# A simple shell script to delete a media from Apache's mod_disk_cache.
|
# A simple shell script to delete a media from Apache's mod_disk_cache.
|
||||||
|
# You will likely need to setup a sudo rule like the following:
|
||||||
|
#
|
||||||
|
# Cmnd_Alias HTCACHECLEAN = /usr/local/sbin/htcacheclean
|
||||||
|
# pleroma ALL=HTCACHECLEAN, NOPASSWD: HTCACHECLEAN
|
||||||
|
|
||||||
SCRIPTNAME=${0##*/}
|
SCRIPTNAME=${0##*/}
|
||||||
|
|
||||||
|
@ -11,15 +15,15 @@ CACHE_DIRECTORY="/tmp/pleroma-media-cache"
|
||||||
## $1 - the filename, can be a pattern .
|
## $1 - the filename, can be a pattern .
|
||||||
## $2 - the cache directory.
|
## $2 - the cache directory.
|
||||||
purge_item() {
|
purge_item() {
|
||||||
htcacheclean -p "${2}" "${1}"
|
sudo htcacheclean -v -p "${2}" "${1}"
|
||||||
} # purge_item
|
} # purge_item
|
||||||
|
|
||||||
purge() {
|
purge() {
|
||||||
for url in "$@"
|
for url in $@
|
||||||
do
|
do
|
||||||
echo "$SCRIPTNAME delete \`$url\` from cache ($CACHE_DIRECTORY)"
|
echo "$SCRIPTNAME delete \`$url\` from cache ($CACHE_DIRECTORY)"
|
||||||
purge_item "$url" $CACHE_DIRECTORY
|
purge_item "$url" $CACHE_DIRECTORY
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
purge "$@"
|
purge $@
|
||||||
|
|
Loading…
Reference in a new issue