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
|
## Sayan 02/10/2003
|
||||||
## Ajout de la synchro du site web : Sayan 04/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 mails : Sayan 19/10/2003
|
||||||
|
## Ajout de la synchro des news et des homes : Sayan 15/11/2003
|
||||||
|
|
||||||
## Nom de fichiers et chemins
|
## Nom de fichiers et chemins
|
||||||
temp_dir=$(mktemp -d)
|
temp_dir=$(mktemp -d)
|
||||||
|
@ -11,35 +12,38 @@ nom_archive=$temp_dir"/backup_"$(hostname)"_"$(date --iso-8601)".tar.bz2"
|
||||||
nom_selections=$temp_dir"/selections"
|
nom_selections=$temp_dir"/selections"
|
||||||
|
|
||||||
## Que sauvegarder ?
|
## Que sauvegarder ?
|
||||||
confs="etc usr/cvs-rep CRANS usr/scripts boot/config*" # via tar bzip2
|
# via tar bzip2
|
||||||
site_web="home/httpd/CVS-Repository" # via rsync
|
confs="etc usr/cvs-rep CRANS usr/scripts boot/config*"
|
||||||
mails="var/spool/mail"
|
# via rsync
|
||||||
|
site_web="/home/httpd/CVS-Repository"
|
||||||
|
mails="/var/spool/mail"
|
||||||
|
news="/var/spool/news"
|
||||||
|
homes="/home"
|
||||||
|
|
||||||
cd /
|
cd /
|
||||||
|
|
||||||
# tgz le contenu des répertoires
|
# tgz le contenu des répertoires
|
||||||
# ajoute dpkg --get-selections
|
# ajoute dpkg --get-selections
|
||||||
|
# echo Preparing to backup configs...
|
||||||
dpkg --get-selections > $nom_selections || exit 1
|
dpkg --get-selections > $nom_selections || exit 1
|
||||||
tar -cjf $nom_archive $confs .$nom_selections || exit 2
|
tar -cjf $nom_archive $confs .$nom_selections || exit 2
|
||||||
|
# echo Sending configs to tanek...
|
||||||
# scp le fichier sur tanek
|
|
||||||
scp $nom_archive backupcrans@tanek: || exit 3
|
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, 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
|
# suppr les fichiers non existant sur zamok
|
||||||
# synchro journalière, switch par semaine
|
# synchro journalière, switch par semaine
|
||||||
week=$(date +%W) # numéro de la semaine
|
week=$(date +%W) # numéro de la semaine
|
||||||
week_mod2=$(( $week % 2 ))
|
week_mod2=$(( $week % 2 ))
|
||||||
rsync -azSHCe ssh --delete $site_web backupcrans@tanek:~/httpd-$week_mod2 || exit 4
|
|
||||||
|
|
||||||
# rsync over ssh pour les mails
|
rsync -azSHe ssh --delete $site_web backupcrans@tanek:~/httpd-$week_mod2 || exit 4
|
||||||
# archive, compress, sparse, hard links, CVS exclude, remote shell
|
rsync -azSHe ssh --delete $mails backupcrans@tanek:/mnt/backup$week_mod2/var/spool || exit 5
|
||||||
# suppr les fichiers non existant sur zamok
|
rsync -azSHe ssh --delete $news backupcrans@tanek:/mnt/backup$week_mod2/var/spool || exit 6
|
||||||
# synchro journalière, switch par semaine
|
# Les homes sont donnés à backupcrans.backup sans les permissions
|
||||||
week=$(date +%W) # numéro de la semaine
|
# Tanek peut alors écrire tous les fichiers, mais restauration non exacte
|
||||||
week_mod2=$(( $week % 2 ))
|
rsync -azSHe ssh --delete $homes backupcrans@tanek:/mnt/backup$week_mod2 || exit 0
|
||||||
rsync -azSHCe ssh --delete $mails backupcrans@tanek:/mnt/backup$week_mod2/var/spool || exit 5
|
|
||||||
|
|
||||||
|
|
||||||
# clean
|
# clean
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue