Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: pg_dump from crontab



Nirav Parikh wrote:
> Hi,
>  
> I am having problem backing up database from crontab, I got following
> lines in crontab file
>  
>  
> 0 20 * * 5 /usr/pgsql/bin/pg_dump -F c database >
> /usr/backup/friDATE4.pgdump
> 0 20 * * 4 pg_dump -F c database > /usr/backup/thurDATE06-3.pgdump
>  
> none of them works, I have given full permission to everyone in
> /usr/backup directory
>  
> it creates the dump file but with 0 size - empty!
>  
> I have other commands in crontab which executes normally, also pg_dump
> command works through command line.
>  
> does anyone what else I can check?

Is the cron backup process running as the same user as your command-line
version? I am, of course, assuming as well that the command-line success
is on the same machine as the crontab.

Are your startup scripts setting any environment variables that may not
be set when cron runs the job?

Is there anything interesting in the PostgreSQL server log at the time
of your backup attempt?

Does a simple command in crontab succeed in writing to the same
directory (something like * * * * * date >> /usr/backup/crondatetest)?

Try redirecting stderr (add something like 2> ~/pg_dump.err to your
crontab command) and see if any errors are being generated. (Most cron
implementations will send an email if anything is output to stderr or
stdout but this assumes that the crontab user's email is actually routed
to someplace that it will end up being seen.)

Cheers,
Steve



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group