#!/bin/sh #] #] ********************* #] $ bash "$d_bin""rsync directories.sh" - backup specific [disk, dir]s # www.BillHowell.ca 04Jun2019 initial based on backup.sh # for details on rsyn options, see man rsync or : # /home/bill/PROJECTS/System_maintenance/Linux/rsync notes.txt source "$d_bin""standard header.sh" dater=$(date +"%y%m%d %kh%Mm") pLog="$d_bin""backupper/rsync directories log.txt" p_excl="$d_bin""rsync directories excludes.txt" # default - 17Sep2023 lost old options, might be missing stuff options='-rup' #] backer() - backer() { dater=$(date +"%y%m%d %kh%Mm") d_src="$1" d_out="$2" echo >>"$pLog" "+---------------------------------------------------------+" echo >>"$pLog" "backer_rsync() - $dater rsync of $d_src to $d_out, " echo >>"$pLog" "" rsync "$options" --exclude-from="$p_excl" "$d_src" "$d_out" >>"$pLog" echo >>"$pLog" "" bash "$d_bin""du_diff.sh" "$d_src" "$d_out" echo >>"$pLog" "" dater=$(date +"%y%m%d %kh%Mm") echo >>"$pLog" "backer_rsync() - $dater end of operation $dater" echo >>"$pLog" "" } backer_NoExcludes() { dater=$(date +"%y%m%d %kh%Mm") d_src="$1" d_out="$2" echo >>"$pLog" "+---------------------------------------------------------+" echo >>"$pLog" "backer_rsync() - $dater rsync of $d_src to $d_out, " echo >>"$pLog" "" rsync "$options" "$d_src" "$d_out" >>"$pLog" echo >>"$pLog" "" bash "$d_bin""du_diff.sh" "$d_src" "$d_out" echo >>"$pLog" "" dater=$(date +"%y%m%d %kh%Mm") echo >>"$pLog" "backer_rsync() - $dater end of operation $dater" echo >>"$pLog" "" } #******************************************************************************* # Special, one-time [move, backup]s - avoid overwrites etc # 07Aug2020 special $d_HOWELL_BASE backup error - find: "Structure needs cleaning" # see "$d_SysMaint""Disk drives/0_disk drive notes.txt" # https://unix.stackexchange.com/questions/330742/cannot-remove-file-structure-needs-cleaning # great comments regarding disk corruption # rsync_HOWELL_BASE() "/media/bill/SWAPPER/" "/media/bill/SWAPPER2/" #******************************************************************************* # Procedures - To run : # For new drive - set ownership to user, eg : # $ sudo chown -R -c bill:bill "/media/bill/SWAPPER2" 2>"/media/bill/SWAPPER/System_maintenance/Linux/chown stderr.txt" >"/media/bill/SWAPPER/System_maintenance/Linux/chown stdout.txt" # for normal existing drives : # 1. Preferences - power (screen & power!!) & screen saver to Never # 2. Select "$options" below - one is just for reporting on what will be done # 2. [create, un-comment] specific rsync desired in "special transfers" list below # 3. save this file # 4 copy-paste to command line : $ bash "$d_bin""rsync directories.sh" # After done : # 1. #*********************************************************** # Run # options="--dry-run --itemize-changes -rltgu " # report what will be done, but no transfers # options="--stats --itemize-changes -rltgu " options="--stats -rltgu " # special transfers : uncomment one to run : : # backer "$d_PROJECTS" "/media/bill/SWAPPER2/" # backer "/home/bill/Thunderbird/" "/media/bill/SAMSUNG_G4/200909 ssh stuff/Thunderbird/" # backer "$d_PROJECTS""My Reviews/" "/media/bill/SAMSUNG_G4/200909 ssh stuff/My Reviews/" # backer "$d_PROJECTS""Servers/" "/media/bill/SAMSUNG_G4/200909 ssh stuff/Servers/" # backer "$d_web" "/media/bill/SAMSUNG_G4/200909 ssh stuff/Website - raw/" # backer "$d_web" "/media/bill/SAMSUNG_G4/200909 ssh stuff/Website - raw/" # backer "$d_PROJECTS""Projects - mini/Pandemics, Kp index, sunspots/" "$d_web"'Pandemics, health, and the Sun/" # backer "$d_web"'Projects - mini/Electric Universe & Mythology/" "$d_web"'Electric Universe/" # 21Jan2021 move PROJECTS, some of [SWAPPER, HOWELL_BASE] to new Dell2 partition on second Dell64 internal drive # backer "$d_PROJECTS" "/media/bill/Dell2/SWAPPER/" # backer "$d_PROJECTS" "/media/bill/Dell2/PROJECTS/" # HOWELL_BASE is special - far too large for whole thing, so "rsync directories excludes.txt" is critical # backer "$d_HOWELL_BASE" "/media/bill/Dell2/HOWELL_BASE/" # I changed drive name to "Major Projects" # backer "/media/bill/WD_3.6Tb/210120 SWAPPER monthly_backup/Website - raw/economics, markets/" "/media/bill/Dell2/SWAPPER/Website - raw/economics, markets/" # 31Aug2022 put all vids on SG6 # backer "/run/media/bill/VIDEOS/" "/home/bill/SG6/VIDEOS/" # backer_NoExcludes '/run/media/bill/VIDEOS/DVD_Geert_Wilders/' '/home/bill/SG6/VIDEOS/DVD_Geert_Wilders/' # backer_NoExcludes '/run/media/bill/VIDEOS/Neural Net videos/' '/home/bill/SG6/VIDEOS/Neural Net videos/' # 04Dec2022 Evolution to LMDE upgrade (lost emails after 26Jul2022) # backer_NoExcludes "/media/bill/USBbackup/Evolution/" "/home/bill/.local/share/evolution/" # backer_NoExcludes "/media/bill/NEUROSCIENCE/" "$d_PROJECTS"'Neural Nets/Brain & Behaviour neuroscience/' # 30Jun2023 NRcan lost directory # backer_NoExcludes "$d_meda"'SEAGATE3_4T/170908 ATA_WDC_500G special_backup/NRCan/' "$d_PROJECTS"'NRCan/' # backer_NoExcludes "$d_PROJECTS"'NRCan/Social media/' "$d_web"'ProjMini/TrNNs-ART/Social media/' # backer_NoExcludes '/media/bill/Seagate Expansion Drive/200203 Ubuntu full backup for storage/DVD_BigBattles_WWII/' '/home/bill/PROJECTS/ProjMajor/Stalin supported Hitler/DVD_BigBattles_WWII/' #backer_htmlOnly # FIRST read procedures above & change [options, files, etc], then run # enddoc