forked from vertelab/odootools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb_backup
19 lines (18 loc) · 824 Bytes
/
db_backup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
for DB in `su postgres -c "psql -At -c \"select datname from pg_database where datistemplate = false and 'postgres' <> datname;\" postgres"`
do
echo $DB
#su odoo -c "odoobackup --database=$DB --filename=/tmp/odoobackup.$$" && mv /tmp/odoobackup.$$ /var/backups/"$DB".zip
#if [ -f /tmp/odoobackup.$$ ]
#then
# rm -f /tmp/odoobackup.$$ ; echo Database $DB not backedup
su postgres -c "pg_dump -Fp $DB " | gzip > /var/backups/"$DB".sql.gz
#fi
# remarked backup with filestore, this is not a good idea when filestore i large and another system takes backup
done
#
# odoobackup uses large amount space on /tmp, if this a problem bind a large partion to /tmp
# sudo mount -o bind /var/tmp /tmp # bind tmp-directory from /var to /tmp
# /etc/fstab:
# /var/tmp /tmp none defaults,bind 0 0
#