Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

UserScripts: Need help for my Backups with rsync incremental script by mgutt

Featured Replies

Hi there, I use the Backup Script by mgutt for all my backups. Now its a little bit anoying to visit every backup folder to check the log file. I want to save all the log files to one share, where i can access them directly. I am not that good at bash scripting so can anybody help me please? I found this in  the end of the script and i tried many things to move the file to a share. But it did not work.

 



 

  # move log file to destination
  log_path=$(rsync --dry-run --itemize-changes --include=".$new_backup/" --include="$new_backup/" --exclude="*" --recursive "$dst_path/" "$empty_dir" | cut -d " " -f 2)
  [[ $log_path ]] && rsync "${dryrun[@]}" --remove-source-files "$log_file" "$dst_path/$log_path/$new_backup.log"
  [[ -f "$log_file" ]] && rm "$log_file"

done

 

 

 

I asked in the Rsync Incremental Thread but no response. I wrote a PN to mgutt but he did not answer to this time. So i try it here again.

 

Thank you for your help!

  • 3 weeks later...

Hi Naitor

 

If you still need help?
I have a lot of fun to write scripts and therefore offer my help.. :)

 

However, I would need a larger section like this.
But there are some errors here.. ^^

 

Maybe this will help you orientate yourself:

# Sample variables (ensure these variables are correctly)
dst_path="/path/to/destination" # Destination directory
log_file="/path/to/logfile.log" # Path to the log file
new_backup="backup-$(date +%Y-%m-%d)" # New backup folder, e.g., backup-2023-04-01

# Create the new backup directory in the destination directory if it does not exist
mkdir -p "$dst_path/$new_backup"

# Check if the log file exists, and then move it using rsync
if [[ -f "$log_file" ]]; then
  # Use rsync to move the log file to the new backup directory and then delete the original
  rsync -av --remove-source-files "$log_file" "$dst_path/$new_backup/"

  # Check if rsync worked correctly
  if [ $? -eq 0 ]; then
    echo "Log file has been moved to: $dst_path/$new_backup/$(basename "$log_file")"
  else
    echo "Failed to move the log file."
  fi
else
  echo "Log file does not exist: $log_file"
fi

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.