]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blame - modules/role/templates/backup/backup_dirname_head.sh.erb
Add a way to specify a port for backup hosts
[perso/Immae/Projets/Puppet.git] / modules / role / templates / backup / backup_dirname_head.sh.erb
CommitLineData
d87a489f 1##### <%= @dirname %> #####
4e8486c1 2PORT="<%= @port %>"
d87a489f
IB
3DEST="<%= @dest %>"
4BASE="<%= @base %>"
5OLD_BAK_BASE=$BASE/older/j
6BAK_BASE=${OLD_BAK_BASE}0
7RSYNC_OUTPUT=$BASE/rsync_output
8NBR=<%= @nbr %>
9
10if ! ssh \
11 -o PreferredAuthentications=publickey \
12 -o StrictHostKeyChecking=yes \
13 -o ClearAllForwardings=yes \
4e8486c1 14 -p $PORT \
d87a489f
IB
15 $DEST backup; then
16 echo "Fichier de verrouillage backup sur $DEST ou impossible de se connecter" >&2
17 skip=$DEST
18fi
19
20rm -rf ${OLD_BAK_BASE}${NBR}
21for j in `seq -w $(($NBR-1)) -1 0`; do
22 [ ! -d ${OLD_BAK_BASE}$j ] && continue
23 mv ${OLD_BAK_BASE}$j ${OLD_BAK_BASE}$(($j+1))
24done
25mkdir $BAK_BASE
26mv $RSYNC_OUTPUT $BAK_BASE
27mkdir $RSYNC_OUTPUT
28
29if [ "$skip" != "$DEST" ]; then