summaryrefslogtreecommitdiff
path: root/installation
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2021-01-25 18:15:04 -0600
committerMark Felder <feld@feld.me>2021-01-25 18:15:04 -0600
commit8373cb645b7f357eedbc3a45a2e75a81376e6ef8 (patch)
tree19e863638e640c373ff7c72059a46c8ccf694e9b /installation
parent0b19534475284b902746be1ee02ed6f1be20a4fa (diff)
Add sudo rule, remove quoting that breaks the for loop
Diffstat (limited to 'installation')
-rwxr-xr-xinstallation/apache-cache-purge.sh.example10
1 files changed, 7 insertions, 3 deletions
diff --git a/installation/apache-cache-purge.sh.example b/installation/apache-cache-purge.sh.example
index be1d36841..62997038d 100755
--- a/installation/apache-cache-purge.sh.example
+++ b/installation/apache-cache-purge.sh.example
@@ -1,6 +1,10 @@
#!/bin/sh
# 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##*/}
@@ -11,15 +15,15 @@ CACHE_DIRECTORY="/tmp/pleroma-media-cache"
## $1 - the filename, can be a pattern .
## $2 - the cache directory.
purge_item() {
- htcacheclean -p "${2}" "${1}"
+ sudo htcacheclean -v -p "${2}" "${1}"
} # purge_item
purge() {
- for url in "$@"
+ for url in $@
do
echo "$SCRIPTNAME delete \`$url\` from cache ($CACHE_DIRECTORY)"
purge_item "$url" $CACHE_DIRECTORY
done
}
-purge "$@"
+purge $@