After backing up the OS via rsync over the Lan to the second PC i want to rsync a few user-folders.
I often forget it (shutdown the source PC, shutdown the LIve-CD, oh?forgotten : shut on everything again...) so i wrote a few lines to put it in a file/script.
I have thought it would be ok, but i need to re-enter the passwd for rsync/ssh for each folder i rsync.
Is there a way around that (besides doing it with exclude. In this case i don't want to use exclude).
Thanks.
Here is the script (like said, i just smashed it together).
The rsync is at the bottom (the rest is chat) for each rsync i need to enter the passwd.
Besides that it does what needs to be done.
Code: Select all
#!/usr/bin/env/bash
# set -e
clear; echo
date
###############
# VARIABLES
##############
SOURCE="m1arkust@debian-sid:/home/m1arkust"
TARGET="/media/backup/home/m1arkust"
echo "
The sources are:
$SOURCE/Documents
$SOURCE/Pictures
$SOURCE/bin
$SOURCE/Programming
The targets are:
$TARGET/Documents
$TARGET/Pictures
$TARGET/bin
$TARGET/Programming "
echo
############################
# FUNKTION asks for going on
############################
function ask_for {
echo -n "
You want to go on?
Say yes or no: "
read answer
case $answer in
[Yy]es | [Yy] ) echo "ok: ";;
*) echo "
You didn't answer yes.
The script will die."
exit 0
esac
}
ask_for
################
# RSYNCING
###############
rsync -e ssh -auv --delete-after "$SOURCE"/Documents/* "$TARGET"/Documents
rsync -e ssh -auv --delete-after --exclude="photos" "$SOURCE"/Pictures/* "$TARGET"/Pictures
rsync -e ssh -auv --delete-after "$SOURCE"/bin/* "$TARGET"/bin
rsync -e ssh -auv --delete-after --exclude="Bash/Git/git" "$SOURCE"/Programming/* "$TARGET"/Programming
notify-send "Done"
exit 0
Might rather be a rsync than a programming question. Just move it around if that is the case.
Thanks