|
@@ -4,7 +4,7 @@
|
4
|
4
|
# Written by Tim Bishop, 2009.
|
5
|
5
|
|
6
|
6
|
# Directories to backup (relative to /)
|
7
|
|
-DIRS="home root decrypted var/www var/lib/postgresql/9.1/main"
|
|
7
|
+DIRS="home root decrypted var/www"
|
8
|
8
|
|
9
|
9
|
# Number of daily backups to keep
|
10
|
10
|
DAILY=7
|
|
@@ -54,8 +54,11 @@ else
|
54
|
54
|
BACKUP="$YEAR$MOY$DOM-$TIME-daily"
|
55
|
55
|
fi
|
56
|
56
|
|
57
|
|
-# Stop postgres
|
58
|
|
-monit stop postgres
|
|
57
|
+# Below command complains to stderr if postgres user cannot write to CWD
|
|
58
|
+cd /home/
|
|
59
|
+
|
|
60
|
+# Dump PostgreSQL to file
|
|
61
|
+sudo -u postgres pg_dumpall -c > /decrypted/postgresql-backup.sql
|
59
|
62
|
|
60
|
63
|
# Do backups
|
61
|
64
|
for dir in $DIRS; do
|
|
@@ -63,9 +66,6 @@ for dir in $DIRS; do
|
63
|
66
|
$TARSNAP $EXTRA_FLAGS -c -f $BACKUP-$dir $dir
|
64
|
67
|
done
|
65
|
68
|
|
66
|
|
-# Start postgres
|
67
|
|
-monit start postgres
|
68
|
|
-
|
69
|
69
|
# Backups done, time for cleaning up old archives
|
70
|
70
|
|
71
|
71
|
# using tail to find archives to delete, but its
|