From 146882e8fe64a517bd9e37cbdb444f86c5690885 Mon Sep 17 00:00:00 2001 From: Greg Anders Date: Fri, 11 Dec 2015 13:11:22 -0600 Subject: [PATCH] Use logs folder in Janitor installation directory --- bin/janitor | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/janitor b/bin/janitor index 22920f3..697c990 100755 --- a/bin/janitor +++ b/bin/janitor @@ -9,11 +9,15 @@ export DAYS_TO_KEEP=$2 # Trash folder to move deleted files to (default: ~/.Trash) export TRASH_DIR=$3 +# Location of Janitor installation +export JANITOR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd)" + if [ -z "$TARGET_DIR" -o -z "$DAYS_TO_KEEP" ]; then echo "Minimum 2 arguments required" exit 1 fi + function clean() { if [ $# -eq 0 ]; then exit 1 @@ -24,7 +28,7 @@ function clean() { fi rm -rf "$1" - LOG="logs/janitor_$(date +"%Y%m%d").log" + LOG="$JANITOR_DIR/logs/janitor_$(date +"%Y%m%d").log" if [ ! -e "$LOG" ]; then echo "Files removed from $TARGET_DIR on $(date +%m-%d-%Y):" > "$LOG" -- 2.26.2