]>
git.immae.eu Git - perso/Immae/Projets/Puppet.git/blob - modules/role/templates/backup/backup_immae_eu.sh.erb
3 MAILTO
="<%= @mailto %>"
5 OLD_BAK_BASE
=$BASE/older
/j
6 BAK_BASE
=${OLD_BAK_BASE}0
7 RSYNC_OUTPUT
=$BASE/rsync_output
13 trap "rm -f $TMP $TMP_STDERR" EXIT
18 if ! `ssh -o ClearAllForwardings=yes $DEST backup`; then
19 echo "Fichier de verrouillage backup sur $DEST"
23 rm -rf ${OLD_BAK_BASE}${NBR}
24 for j
in `seq -w $(($NBR-1)) -1 0`; do
25 [ ! -d ${OLD_BAK_BASE}$j ] && continue
26 mv ${OLD_BAK_BASE}$j ${OLD_BAK_BASE}$(($j+1))
29 mv $RSYNC_OUTPUT $BAK_BASE
39 /hosts/florian/nobackup/
40 /hosts/connexionswing.com/
41 /hosts/connexionswing.immae.eu/
42 /hosts/ludivine.immae.eu/
43 /hosts/ludivinecassal.com/
44 /hosts/piedsjaloux.fr/
45 /hosts/piedsjaloux.immae.eu/
49 OUT
=$RSYNC_OUTPUT/$NAME
50 rsync
-XAavbrz --fake-super -e ssh --numeric-ids --delete \
51 --backup-dir=$BAK_BASE/$NAME --exclude-from=$TMP \
52 $DEST:$FOLDER .
> $OUT || true
67 OUT
=$RSYNC_OUTPUT/$NAME
68 rsync
-XAavbrz -R --fake-super -e ssh --numeric-ids --delete \
69 --rsync-path='sudo rsync' \
70 --backup-dir=$BAK_BASE/$NAME \
72 $DEST:$FOLDER .
> $OUT || true
75 ssh $DEST sh
-c "date > .last_backup"
77 if [ -s "$TMP_STDERR" ]; then
78 cat "$TMP_STDERR" | mail -Ssendwait -s "save_distant rsync error" "$MAILTO"