Browse Source

fix(tarsnap): rotate script fails on error

Scripts used to rotate tarsnap backups exit when a command fails
Cron will catch that return code is not zero and will send message to root

No more silent failure
Bertrand Cachet 11 years ago
parent
commit
ead57335be
1 changed files with 2 additions and 7 deletions
  1. 2
    7
      roles/tarsnap/files/tarsnap.sh

+ 2
- 7
roles/tarsnap/files/tarsnap.sh View File

22
 MONTHLY_DAY=01
22
 MONTHLY_DAY=01
23
 
23
 
24
 # Path to tarsnap
24
 # Path to tarsnap
25
-#TARSNAP="/home/tdb/tarsnap/tarsnap.pl"
26
 TARSNAP="/usr/local/bin/tarsnap"
25
 TARSNAP="/usr/local/bin/tarsnap"
27
 
26
 
28
 # end of config
27
 # end of config
29
 
28
 
29
+set -e
30
+
30
 # day of week: 1-7, monday = 1
31
 # day of week: 1-7, monday = 1
31
 DOW=`date +%u`
32
 DOW=`date +%u`
32
 # day of month: 01-31
33
 # day of month: 01-31
52
 
53
 
53
 # Do backups
54
 # Do backups
54
 for dir in $DIRS; do
55
 for dir in $DIRS; do
55
-	# nasty bodge for my large /home :-)
56
-	EXTRA_FLAGS=
57
-	if [ X"$dir" = X"/home" ]; then
58
-		EXTRA_FLAGS="--lowmem"
59
-	fi
60
-
61
 	echo "==> create $BACKUP-$dir"
56
 	echo "==> create $BACKUP-$dir"
62
 	$TARSNAP $EXTRA_FLAGS -c -f $BACKUP-$dir $dir
57
 	$TARSNAP $EXTRA_FLAGS -c -f $BACKUP-$dir $dir
63
 done
58
 done

Loading…
Cancel
Save