summaryrefslogtreecommitdiff
path: root/rsync_tmbackup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'rsync_tmbackup.sh')
-rwxr-xr-xrsync_tmbackup.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh
index be0a0da..1335766 100755
--- a/rsync_tmbackup.sh
+++ b/rsync_tmbackup.sh
@@ -46,6 +46,9 @@ fn_display_usage() {
echo " not be managed by the script - in particular they will not be"
echo " automatically deleted."
echo " Default: $LOG_DIR"
+ echo " --log-to-destination Set the log file directory to the destination directory. If this flag"
+ echo " is set, generated files will not be managed by the script - in particular"
+ echo " they will not be automatically deleted."
echo " --strategy Set the expiration strategy. Default: \"1:1 30:7 365:30\" means after one"
echo " day, keep one backup per day. After 30 days, keep one backup every 7 days."
echo " After 365 days keep one backup every 30 days."
@@ -277,6 +280,7 @@ DEST_FOLDER=""
EXCLUSION_FILE=""
LOG_DIR="$HOME/.$APPNAME"
AUTO_DELETE_LOG="1"
+LOG_TO_DEST="0"
EXPIRATION_STRATEGY="1:1 30:7 365:30"
AUTO_EXPIRE="1"
@@ -318,6 +322,10 @@ while :; do
LOG_DIR="$1"
AUTO_DELETE_LOG="0"
;;
+ --log-to-destination)
+ LOG_TO_DEST="1"
+ AUTO_DELETE_LOG="0"
+ ;;
--no-auto-expire)
AUTO_EXPIRE="0"
;;
@@ -439,6 +447,10 @@ MYPID="$$"
# Create log folder if it doesn't exist
# -----------------------------------------------------------------------------
+if [[ $LOG_TO_DEST == "1" ]]; then
+ LOG_DIR="$DEST_FOLDER/.$APPNAME"
+fi
+
if [ ! -d "$LOG_DIR" ]; then
fn_log_info "Creating log folder in '$LOG_DIR'..."
mkdir -- "$LOG_DIR"