[icinga-checkins] icinga.org: icinga-web/next: Allow clearcache for non-root users ( refs #3864)

git at icinga.org git at icinga.org
Fri Mar 15 17:13:21 CET 2013


Module: icinga-web
Branch: next
Commit: c0fb4550ab7bb3f37fce0b346f9afc319652014f
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=c0fb4550ab7bb3f37fce0b346f9afc319652014f

Author: Markus Frosch <markus at lazyfrosch.de>
Date:   Fri Mar 15 17:11:41 2013 +0100

Allow clearcache for non-root users (refs #3864)

The command can now be run for every user that has write access.

In addition the rm command is called with -f

This allows removing of files that the user has only
write access via the directory (for the Squished files).

But every real deletion problem is still reported.

---

 bin/clearcache.sh.in |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/clearcache.sh.in b/bin/clearcache.sh.in
index f80be01..4d12a15 100644
--- a/bin/clearcache.sh.in
+++ b/bin/clearcache.sh.in
@@ -21,8 +21,8 @@ function msg_result {
 	NOTHING=false
 }
 
-if [[ $UID -gt 0 ]]; then
-	echo "You should run this as root"
+if [ ! -w "$CACHEDIR" ]; then
+	echo "You have no filesystem permission to clear the cache!" >&2
 	exit 1
 fi
 
@@ -43,7 +43,7 @@ for CUR_CDIR in $CCDIR; do
 
 		msg_start "Deleting cache from $CUR_CNAME ($CC_FILES files)"
 
-		find $CUR_CDIR/ -type f -exec rm {} \;
+		find $CUR_CDIR/ -type f -exec rm -f {} \;
 
 		msg_result
 





More information about the icinga-checkins mailing list