Ajout de la synchro du site web par rsync over ssh

--
Sayan

darcs-hash:20031004191345-d1356-428d6db10ff0b97cdc615788a449644ad46bb103.gz
This commit is contained in:
sayan 2003-10-04 21:13:45 +02:00
parent b82644de83
commit 4e426cdf44

View file

@ -1,7 +1,8 @@
#!/bin/sh #!/bin/sh
## Sauvegarde des fichiers de conf sur Tanek ## Sauvegarde des fichiers de conf et du site web CRANS sur Tanek
## Sayan 02/10/2003 ## Sayan 02/10/2003
## Ajout de la synchro du site web : Sayan 04/10/2003
## Nom de fichiers et chemins ## Nom de fichiers et chemins
temp_dir=$(mktemp -d) temp_dir=$(mktemp -d)
@ -9,15 +10,25 @@ 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 ?
rep="/etc /usr/cvs-rep /CRANS /usr/scripts /boot/config*" confs="/etc /usr/cvs-rep /CRANS /usr/scripts /boot/config*" # via tar bzip2
site_web="/home/httpd/CVS-Repository" # via rsync
# tgz le contenu des répertoires # tgz le contenu des répertoires
# ajoute dpkg --get-selections # ajoute dpkg --get-selections
dpkg --get-selections > $nom_selections || exit 1 dpkg --get-selections > $nom_selections || exit 1
tar -cjf $nom_archive $rep $nom_selections || exit 2 tar -cjf $nom_archive $confs $nom_selections || exit 2
# scp le fichier sur 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
# 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 $site_web backupcrans@tanek:~/httpd-$week_mod2 || exit 4
# clean # clean
rm -rf $temp_dir rm -rf $temp_dir