PostgreSQL - How do we run full daily scheduled backup

I'm using Postgresql enterprise db, I wonder how do I run a daily full backups for postgresql and make a removal of old files after 2 weeks ? Is there anyone have the script to complete this task ?
I'm running Postgresql with Redhat Linux
motioneyeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dec0mpileCommented:
Have you tried to use the script that PostgreSQL has posted on the wiki?:

http://wiki.postgresql.org/wiki/Automated_Backup_on_Linux
0
motioneyeAuthor Commented:
Hi dec0mpile,
Thanks, didnt know wiki have something similar...
Should I create as single file then run as sh or do I have to create 3 different files for each of them
0
dec0mpileCommented:
For your case you should only need two files. The pg_backup_rotated.sh with the code provided and pg_backup.config with the configuration options filled in. They should be in the same directory (or edit the path in the code)
0
MazdajaiCommented:
You need all three files -

pg_backup.config - The main configuration file. This should be the only file which needs user modifications.
pg_backup.sh - The normal backup script which will go through each database and save a gzipped and/or a custom format copy of the backup into a date-based directory.
pg_backup_rotated.sh - The same as above except it will delete expired backups based on the configuration.

You can modify the parameter in the backup script to fit your needs -

# Number of days to keep daily backups
DAYS_TO_KEEP=7

Open in new window

0
dec0mpileCommented:
Sorry, @Mazdajai is correct you need all files.

See this step-by-step, also it may clear things up (it's for Ubuntu but the idea is the same)

http://technobytz.com/automatic-sql-database-backup-postgres.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PostgreSQL

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.