From e5f939222e2d6be96e12e172dfeaa633fc296f42 Mon Sep 17 00:00:00 2001 From: Robert Bruce Park Date: Tue, 26 Nov 2013 12:59:00 -0800 Subject: Determine $APPNAME programmatically. --- rsync_tmbackup.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh index 4a42b1f..ed203b6 100644 --- a/rsync_tmbackup.sh +++ b/rsync_tmbackup.sh @@ -1,12 +1,14 @@ #!/usr/bin/env bash +APPNAME=$(basename $0 | sed "s/\.sh$//") + # ----------------------------------------------------------------------------- # Log functions # ----------------------------------------------------------------------------- -fn_log_info() { echo "rsync_tmbackup: $1"; } -fn_log_warn() { echo "rsync_tmbackup: [WARNING] $1"; } -fn_log_error() { echo "rsync_tmbackup: [ERROR] $1"; } +fn_log_info() { echo "$APPNAME: $1"; } +fn_log_warn() { echo "$APPNAME: [WARNING] $1"; } +fn_log_error() { echo "$APPNAME: [ERROR] $1"; } # ----------------------------------------------------------------------------- # Make sure everything really stops when CTRL+C is pressed @@ -92,7 +94,7 @@ KEEP_DAILIES_DATE=$(($EPOCH - 2678400)) # 31 days ago export IFS=$'\n' # Better for handling spaces in filenames. -PROFILE_FOLDER="$HOME/.rsync_tmbackup" +PROFILE_FOLDER="$HOME/.$APPNAME" DEST=$DEST_FOLDER/$NOW PREVIOUS_DEST=$(fn_find_backups | head -n 1) INPROGRESS_FILE=$DEST_FOLDER/backup.inprogress -- cgit v1.2.3