We have write shell script for take backup postgres dump
#!/bin/bash
CURD=$(date +"%d%m%Y")
#/usr/bin/pg_dump --host 192.168.XX.XX --port 5432 --username "postgres" --no-password --format custom --blobs --verbose --file "/media2/backup/postgres_dump/postgres_$CURD" "postgres"
#/usr/bin/pg_dump --host 192.168.XX.XX --port 5432 --username "postgres" --no-password --format custom --blobs --verbose --file "/media2/backup/postgres_dump/WeatherLive-$CURD" "WeatherLive"
/usr/bin/pg_dump --host 192.168.xx.xx --port 5432 --username "postgres" --no-password --format custom --blobs --verbose --file "/media2/backup/postgres_odk_dump/odk_prod-$CURD" "odk_prod"
#/usr/bin/pg_dump --host 192.168.xx.xx --port 5432 --username "postgres" --no-password --format custom -T "odk_prod.*_BLB" --verbose --file "/media2/backup/postgres_dump/odk_prod-$CURD" "odk_prod"
find /media2/backup/postgres_odk_dump/ -type f -mtime +14 -exec rm {} \;
Go to crontab :
#crontab -e
5 01 * * SUN sh /root/it/private/postgres_odk_dump.sh
No comments:
Post a Comment