Wednesday, February 26, 2014

Backup Postgresql database pada Linux

Step 1:  Create script to backup database
cat /opt/backup_postgresql.sh
#!/bin/sh
export PGPASSWORD=xxxxxxxx
/opt/PostgreSQL/9.0/bin/pg_dump database1 -U user > /tmp/Backup/database1_db_$(date +%Y-%m-%d) 

Step 2: Create crontab to run automatically everyday.
00 00 * * *  /opt/backup_postgresql.sh

No comments:

Post a Comment