Re: CRON Jobs and Backups - Mailing list pgsql-novice

From Tom Lane
Subject Re: CRON Jobs and Backups
Date
Msg-id 25900.1118119407@sss.pgh.pa.us
Whole thread Raw
In response to CRON Jobs and Backups  (<operationsengineer1@yahoo.com>)
List pgsql-novice
<operationsengineer1@yahoo.com> writes:
> as i understand it...  the following should enable me
> to backup via cron:

> PGUSER=postgres
> PGPASSWORD=password
> export PGUSER PGPASSWORD
> pg_dump databasename | gzip > databasename.bak.gz

This is probably a pretty bad way to handle the password --- on many
Unix variants, anyone can see the list of environment variables that is
passed down to the pg_dump process.  It'd be far safer to put the
password in a ~/.pgpass file owned by the Unix user that runs the cron
job.

> my interfaces is cpanel and it only gives me one line
> to type this in...  can i replace the returns with a
> space and will this still work?

Get a better user interface ;-).  Or put the whole mess in a script file
and invoke the script file from your cron job.

            regards, tom lane

pgsql-novice by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: [despammed] CRON Jobs and Backups
Next
From: Aarni Ruuhimäki
Date:
Subject: Re: CRON Jobs and Backups