ajout synchro des news et des homes. La synchro des homes est dfectueuse, et choue sur les rpertoires auquel root@zamok peut accder mais pas backupcrans@tanek. Le script ne devrait pas chouer, mais la restauration ne pourra pas tre complte.
-- Sayan darcs-hash:20031124163405-d1356-a1004241032455ed9d4ed704185d802795c0e805.gz
This commit is contained in:
parent
e8a3d6939a
commit
83aa97009d
1 changed files with 18 additions and 14 deletions
32
backup.sh
32
backup.sh
|
@ -4,6 +4,7 @@
|
|||
## Sayan 02/10/2003
|
||||
## Ajout de la synchro du site web : Sayan 04/10/2003
|
||||
## Ajout de la synchro des mails : Sayan 19/10/2003
|
||||
## Ajout de la synchro des news et des homes : Sayan 15/11/2003
|
||||
|
||||
## Nom de fichiers et chemins
|
||||
temp_dir=$(mktemp -d)
|
||||
|
@ -11,35 +12,38 @@ nom_archive=$temp_dir"/backup_"$(hostname)"_"$(date --iso-8601)".tar.bz2"
|
|||
nom_selections=$temp_dir"/selections"
|
||||
|
||||
## Que sauvegarder ?
|
||||
confs="etc usr/cvs-rep CRANS usr/scripts boot/config*" # via tar bzip2
|
||||
site_web="home/httpd/CVS-Repository" # via rsync
|
||||
mails="var/spool/mail"
|
||||
# via tar bzip2
|
||||
confs="etc usr/cvs-rep CRANS usr/scripts boot/config*"
|
||||
# via rsync
|
||||
site_web="/home/httpd/CVS-Repository"
|
||||
mails="/var/spool/mail"
|
||||
news="/var/spool/news"
|
||||
homes="/home"
|
||||
|
||||
cd /
|
||||
|
||||
# tgz le contenu des répertoires
|
||||
# ajoute dpkg --get-selections
|
||||
# echo Preparing to backup configs...
|
||||
dpkg --get-selections > $nom_selections || exit 1
|
||||
tar -cjf $nom_archive $confs .$nom_selections || exit 2
|
||||
|
||||
# scp le fichier sur tanek
|
||||
# echo Sending configs to tanek...
|
||||
scp $nom_archive backupcrans@tanek: || exit 3
|
||||
|
||||
# rsync over ssh pour le site web
|
||||
# rsync over ssh pour le site web, les homes, les mails et les news
|
||||
# archive, compress, sparse, hard links, CVS exclude, remote shell
|
||||
# archive is rlptgoD : recursive, symlinks, perms, times, group, owner, Devices
|
||||
# suppr les fichiers non existant sur zamok
|
||||
# synchro journalière, switch par semaine
|
||||
week=$(date +%W) # numéro de la semaine
|
||||
week_mod2=$(( $week % 2 ))
|
||||
rsync -azSHCe ssh --delete $site_web backupcrans@tanek:~/httpd-$week_mod2 || exit 4
|
||||
|
||||
# rsync over ssh pour les mails
|
||||
# archive, compress, sparse, hard links, CVS exclude, remote shell
|
||||
# suppr les fichiers non existant sur zamok
|
||||
# synchro journalière, switch par semaine
|
||||
week=$(date +%W) # numéro de la semaine
|
||||
week_mod2=$(( $week % 2 ))
|
||||
rsync -azSHCe ssh --delete $mails backupcrans@tanek:/mnt/backup$week_mod2/var/spool || exit 5
|
||||
rsync -azSHe ssh --delete $site_web backupcrans@tanek:~/httpd-$week_mod2 || exit 4
|
||||
rsync -azSHe ssh --delete $mails backupcrans@tanek:/mnt/backup$week_mod2/var/spool || exit 5
|
||||
rsync -azSHe ssh --delete $news backupcrans@tanek:/mnt/backup$week_mod2/var/spool || exit 6
|
||||
# Les homes sont donnés à backupcrans.backup sans les permissions
|
||||
# Tanek peut alors écrire tous les fichiers, mais restauration non exacte
|
||||
rsync -azSHe ssh --delete $homes backupcrans@tanek:/mnt/backup$week_mod2 || exit 0
|
||||
|
||||
|
||||
# clean
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue