improve backup script
This commit is contained in:
parent
1c6e30dc83
commit
87101e8349
|
@ -5,24 +5,23 @@ set -x
|
||||||
# backup.sh
|
# backup.sh
|
||||||
|
|
||||||
pre="/home/fschl"
|
pre="/home/fschl"
|
||||||
target="/media/driveBay/Backups"
|
target="/media/black_Backups/2018-12"
|
||||||
|
# target="/media/driveBay/Backups"
|
||||||
|
|
||||||
folders=( "Documents" #contains Org files
|
folders=( "Documents" #contains Org files
|
||||||
"Downloads"
|
"Downloads"
|
||||||
"projects"
|
"projects"
|
||||||
)
|
)
|
||||||
|
|
||||||
folders_sensitive=( ".gnupg"
|
folders_sensitive=(
|
||||||
".mozilla"
|
".mozilla"
|
||||||
".thunderbird"
|
".thunderbird"
|
||||||
".ssh"
|
".ssh"
|
||||||
".config/etc-tinc"
|
".config/etc-tinc"
|
||||||
)
|
)
|
||||||
|
|
||||||
files=( ".android"
|
files=(
|
||||||
".gradle"
|
|
||||||
".bash_history"
|
".bash_history"
|
||||||
".Clion2016.3"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
@ -41,7 +40,19 @@ main() {
|
||||||
mkdir -p ${target}/$dir
|
mkdir -p ${target}/$dir
|
||||||
fi
|
fi
|
||||||
echo "${pre}/${dir} --> ${target}/${dir}"
|
echo "${pre}/${dir} --> ${target}/${dir}"
|
||||||
rsync --progress -ruv "${pre}/${dir}" "${target}/"
|
rsync --progress -ruv --ignore-existing "${pre}/${dir}" "${target}/"
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
|
||||||
|
sensitive)
|
||||||
|
for dir in "${folders_sensitive[@]}";
|
||||||
|
do
|
||||||
|
if [ ! -d "${target}/${dir}" ]; then
|
||||||
|
echo "creating non-existing dir: ${target}/dotdirectories/${dir}"
|
||||||
|
mkdir -p ${target}/dotdirectories/$dir
|
||||||
|
fi
|
||||||
|
echo "${pre}/${dir} --> ${target}/${dir}"
|
||||||
|
rsync --progress -ruv --ignore-existing "${pre}/${dir}" "${target}/dotdirectories/"
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue