mirror of
https://github.com/brunofontes/linuxShortcuts.git
synced 2024-11-24 03:07:48 +00:00
Improving the script to use 2 HDs
This commit is contained in:
parent
a4808a0e61
commit
5799d5a332
@ -1,16 +1,20 @@
|
||||
YEARMONTH=`date +%Y/%m-%b`
|
||||
YEAR=`date +%Y`
|
||||
HDPath="/run/media/bruno/Seagate"
|
||||
HDPath="/run/media/bruno/Backup_"
|
||||
LastDisk=$(< .lastDisk)
|
||||
|
||||
if [ "$LastDisk" = '1' ]; then
|
||||
NextDisk=2
|
||||
else
|
||||
NextDisk=1
|
||||
fi
|
||||
|
||||
backup="rsync -aq --inplace --exclude-from=./exclude"
|
||||
HDPath="$HDPath$NextDisk"
|
||||
HDYEARMONTH="$HDPath/$YEARMONTH"
|
||||
|
||||
mkdir -p "$HDPath/$YEAR"
|
||||
mkdir -p "$HDYEARMONTH"
|
||||
mkdir -p "$HDYEARMONTH/LinuxHome"
|
||||
mkdir -p "$HDYEARMONTH/LinuxHome/bruno"
|
||||
mkdir -p "$HDYEARMONTH/LinuxHome/admin"
|
||||
mkdir -p "$HDYEARMONTH/LinuxHome/lost+found"
|
||||
|
||||
backup="rsync -rptgoDql --exclude-from=./exclude"
|
||||
# If folder does not exist, exit with error
|
||||
[ ! -d "$HDPath" ] && echo "This disk was used last time. Please, plug Backup_$NextDisk before running this script." && exit 1
|
||||
|
||||
echo
|
||||
echo "Backup command : $backup"
|
||||
@ -21,6 +25,14 @@ echo Press enter key to start the backup
|
||||
read
|
||||
echo
|
||||
|
||||
mkdir -p "$HDPath/$YEAR"
|
||||
mkdir -p "$HDYEARMONTH"
|
||||
mkdir -p "$HDYEARMONTH/LinuxHome"
|
||||
mkdir -p "$HDYEARMONTH/LinuxHome/bruno"
|
||||
mkdir -p "$HDYEARMONTH/LinuxHome/admin"
|
||||
mkdir -p "$HDYEARMONTH/LinuxHome/lost+found"
|
||||
|
||||
|
||||
echo -e "\e[97m`date +%r` - Copying Dropbox folder (1/7)...\e[39m"
|
||||
eval $backup "/run/media/bruno/Multimedia/Dropbox" "$HDYEARMONTH/Multimedia/" || echo ""
|
||||
|
||||
@ -52,4 +64,5 @@ eval $backup "/run/media/bruno/Multimedia/Virtual\ Machines" "$HDPath/$YEAR/" ||
|
||||
|
||||
echo -e "\e[97m`date +%r` - Backup finished. Please, verify your log files.\e[39m"
|
||||
|
||||
echo "$NextDisk" > .lastDisk
|
||||
kdialog --title "Backup Complete" --msgbox "Backup finished successfully"
|
||||
|
1
Backup/.lastDisk
Normal file
1
Backup/.lastDisk
Normal file
@ -0,0 +1 @@
|
||||
1
|
@ -3,3 +3,4 @@ Downloads/*
|
||||
TransMit\ Tools\ -\ Studio\ 2015/*
|
||||
Apps/*
|
||||
shared/*
|
||||
.npm/*
|
||||
|
Loading…
Reference in New Issue
Block a user