PostgreSQL backup

#!/bin/bash
CAS=`date +"%d.%m.%y %T"`
echo "Zacetek dumpanja: $CAS"
echo "Zacetek dumpanja: $CAS" >> /var/log/postdump.err
cd /var/backup/postgres
rm -f *.sql.gz
cd /var/lib/postgresql
 
for baza in `/bin/su -c "psql -l" postgres | tr -d ' ' | egrep -v "Name|-|Listofdatabases|rows|template0" | cut -f1 -d '|' | sed -e   '/^$/d'`
   do
      echo "Obdelujem bazo $baza"
      /bin/su -c "pg_dump $baza > $baza.sql" postgres
      gzip -f --best $baza.sql
     mv $baza.sql.gz /var/backup/postgres
   done
   
CAS=`date +"%d.%m.%y %T"`
echo "Konec: $CAS"
echo "Konec: $CAS" >> /var/log/postdump.err
echo
echo >> /var/log/postdump.err
postgresql/backup.txt · Last modified: 2012/05/17 08:36 by greebo
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready