~gpanders/pushbroom

146882e8fe64a517bd9e37cbdb444f86c5690885 — Greg Anders 4 years ago bb029b8
Use logs folder in Janitor installation directory
1 files changed, 5 insertions(+), 1 deletions(-)

M bin/janitor
M bin/janitor => bin/janitor +5 -1
@@ 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"