diff options
| author | Robert Bruce Park <r@robru.ca> | 2013-11-26 12:59:00 -0800 |
|---|---|---|
| committer | Robert Bruce Park <r@robru.ca> | 2013-11-26 12:59:00 -0800 |
| commit | e5f939222e2d6be96e12e172dfeaa633fc296f42 (patch) | |
| tree | 4dbbf3b091785891848b54b9e0f9d9552bfadcac | |
| parent | 0db8b3a913ff2cd890584284f1408ba095fb8e43 (diff) | |
Determine $APPNAME programmatically.
| -rw-r--r-- | rsync_tmbackup.sh | 10 |
1 files 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 |
