diff options
| author | gahowork <github_gahowork@gaho.at> | 2025-05-27 14:30:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-27 13:30:01 +0100 |
| commit | 9b3ea2d41036bcebb8da4564cab35b5019a552cd (patch) | |
| tree | 87b236a1935ef72f3791176c63026ae9d0b97140 /rsync_tmbackup.sh | |
| parent | c0b2ccd7c1bf1740cb96f5e4066913d59ce44971 (diff) | |
Log to destination (#280)
Diffstat (limited to 'rsync_tmbackup.sh')
| -rwxr-xr-x | rsync_tmbackup.sh | 12 |
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" |
