Browse Source

Changed tarsnap.sh to not shut down postgresql, instead use the pg_dumpall command to create a .sql backup file in /decrypted/. Much better than shutting down the entire db server.

Michael West 10 years ago
parent
commit
0c01f4cdf0
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      roles/tarsnap/files/tarsnap.sh

+ 6
- 6
roles/tarsnap/files/tarsnap.sh View File

4
 # Written by Tim Bishop, 2009.
4
 # Written by Tim Bishop, 2009.
5
 
5
 
6
 # Directories to backup (relative to /)
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
 # Number of daily backups to keep
9
 # Number of daily backups to keep
10
 DAILY=7
10
 DAILY=7
54
 	BACKUP="$YEAR$MOY$DOM-$TIME-daily"
54
 	BACKUP="$YEAR$MOY$DOM-$TIME-daily"
55
 fi
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
 # Do backups
63
 # Do backups
61
 for dir in $DIRS; do
64
 for dir in $DIRS; do
63
 	$TARSNAP $EXTRA_FLAGS -c -f $BACKUP-$dir $dir
66
 	$TARSNAP $EXTRA_FLAGS -c -f $BACKUP-$dir $dir
64
 done
67
 done
65
 
68
 
66
-# Start postgres
67
-monit start postgres
68
-
69
 # Backups done, time for cleaning up old archives
69
 # Backups done, time for cleaning up old archives
70
 
70
 
71
 # using tail to find archives to delete, but its
71
 # using tail to find archives to delete, but its

Loading…
Cancel
Save