aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-02-26 12:43:27 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-03-19 00:53:18 +0100
commit23fd00ce5f8aa6d8419d56166f658361c1321add (patch)
treedc3db4e9d0d822558f4a59316819da7b8b63ce11 /modules
parentc6a29ebe788799aa75ebc7a4e436915048221b39 (diff)
downloadPuppet-23fd00ce5f8aa6d8419d56166f658361c1321add.tar.gz
Puppet-23fd00ce5f8aa6d8419d56166f658361c1321add.tar.zst
Puppet-23fd00ce5f8aa6d8419d56166f658361c1321add.zip
Change last_backup location for backup
Diffstat (limited to 'modules')
-rw-r--r--modules/role/templates/backup/backup_dirname_tail.sh.erb2
-rw-r--r--modules/role/templates/backup/backup_immae_eu.sh.erb79
2 files changed, 1 insertions, 80 deletions
diff --git a/modules/role/templates/backup/backup_dirname_tail.sh.erb b/modules/role/templates/backup/backup_dirname_tail.sh.erb
index 6b16c9d..5027992 100644
--- a/modules/role/templates/backup/backup_dirname_tail.sh.erb
+++ b/modules/role/templates/backup/backup_dirname_tail.sh.erb
@@ -1,4 +1,4 @@
1 1
2 ssh $DEST sh -c "date > .last_backup" 2 ssh $DEST sh -c "date > .cache/last_backup"
3fi # [ "$skip" != "$DEST" ] 3fi # [ "$skip" != "$DEST" ]
4##### End <%= @dirname %> ##### 4##### End <%= @dirname %> #####
diff --git a/modules/role/templates/backup/backup_immae_eu.sh.erb b/modules/role/templates/backup/backup_immae_eu.sh.erb
deleted file mode 100644
index 4fab30e..0000000
--- a/modules/role/templates/backup/backup_immae_eu.sh.erb
+++ /dev/null
@@ -1,79 +0,0 @@
1#!/bin/bash
2DEST="<%= @dest %>"
3MAILTO="<%= @mailto %>"
4BASE="<%= @base %>"
5OLD_BAK_BASE=$BASE/older/j
6BAK_BASE=${OLD_BAK_BASE}0
7RSYNC_OUTPUT=$BASE/rsync_output
8NBR=7
9
10TMP=`mktemp`
11TMP_STDERR=`mktemp`
12
13trap "rm -f $TMP $TMP_STDERR" EXIT
14
15exec 2> "$TMP_STDERR"
16
17set -e
18if ! `ssh -o ClearAllForwardings=yes $DEST backup`; then
19 echo "Fichier de verrouillage backup sur $DEST"
20 exit 1
21fi
22
23rm -rf ${OLD_BAK_BASE}${NBR}
24for 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))
27done
28mkdir $BAK_BASE
29mv $RSYNC_OUTPUT $BAK_BASE
30mkdir $RSYNC_OUTPUT
31
32##############
33NAME="home"
34FOLDER="/home/immae"
35
36cd $BASE/$NAME
37cat > $TMP <<EOF
38/.no_backup/
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/
46/hosts/spip/sites/*/
47/hosts/spip/spip*
48EOF
49OUT=$RSYNC_OUTPUT/$NAME
50rsync -XAavbrz --fake-super -e ssh --numeric-ids --delete \
51 --backup-dir=$BAK_BASE/$NAME --exclude-from=$TMP \
52 $DEST:$FOLDER . > $OUT || true
53
54##############
55NAME="system"
56FOLDER="/"
57
58cd $BASE/$NAME
59cat > $TMP <<EOF
60/etc/
61/srv/
62/var/lib/
63/var/spool/
64/var/named/
65/usr/local/
66EOF
67OUT=$RSYNC_OUTPUT/$NAME
68rsync -XAavbrz -R --fake-super -e ssh --numeric-ids --delete \
69 --rsync-path='sudo rsync' \
70 --backup-dir=$BAK_BASE/$NAME \
71 --files-from=$TMP \
72 $DEST:$FOLDER . > $OUT || true
73
74##############
75ssh $DEST sh -c "date > .last_backup"
76
77if [ -s "$TMP_STDERR" ]; then
78 cat "$TMP_STDERR" | mail -Ssendwait -s "save_distant rsync error" "$MAILTO"
79fi