technical skills grow

Responsive Ads Here

Tuesday, June 8, 2021

Part-23 Postgres dump shell script

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

Powered by Blogger.

Labels

Contact Form

Name

Email *

Message *

Search This Blog

Blog Archive

Ad Code

Responsive Advertisement

Recent Posts