pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_dump from crontab
5+ messages / 5 participants
[nested] [flat]
* pg_dump from crontab
@ 2006-08-04 07:20 Nirav Parikh <niravp@alliancerecruitment.com.au>
2006-08-10 19:00 ` Re: pg_dump from crontab Ivo Rossacher <rossacher@bluewin.ch>
2006-08-10 19:03 ` Re: pg_dump from crontab Scott Marlowe <smarlowe@g2switchworks.com>
2006-08-10 19:04 ` Re: pg_dump from crontab Steve Crawford <scrawford@pinpointresearch.com>
2006-08-11 06:06 ` Re: pg_dump from crontab Adam Radlowski <adamr@informatyka.gdansk.pl>
0 siblings, 4 replies; 5+ messages in thread
From: Nirav Parikh @ 2006-08-04 07:20 UTC (permalink / raw)
To: pgsql-admin
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?
Regards,
Nirav
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pg_dump from crontab
2006-08-04 07:20 pg_dump from crontab Nirav Parikh <niravp@alliancerecruitment.com.au>
@ 2006-08-10 19:00 ` Ivo Rossacher <rossacher@bluewin.ch>
3 siblings, 0 replies; 5+ messages in thread
From: Ivo Rossacher @ 2006-08-10 19:00 UTC (permalink / raw)
To: pgsql-admin
Am Freitag, 4. August 2006 09.20 schrieb Nirav Parikh:
> 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?
Probably the permission at the database which the user has that owns the
crontab file?
Does the command work in a shell of this user?
Best regards
Ivo
>
>
>
>
> Regards,
>
>
>
>
>
> Nirav
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pg_dump from crontab
2006-08-04 07:20 pg_dump from crontab Nirav Parikh <niravp@alliancerecruitment.com.au>
@ 2006-08-10 19:03 ` Scott Marlowe <smarlowe@g2switchworks.com>
3 siblings, 0 replies; 5+ messages in thread
From: Scott Marlowe @ 2006-08-10 19:03 UTC (permalink / raw)
To: Nirav Parikh <niravp@alliancerecruitment.com.au>; +Cc: pgsql-admin
On Fri, 2006-08-04 at 02:20, 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?
Often, I need to add the path to the pg_dump files, and I also set my
shell and home directory in my crontab. Don't know if it'll help, but
it won't hurt.
PATH=/usr/local/pgsql/bin:/bin:/usr/bin
SHELL=/bin/bash
HOME=/home/smarlowe
Then I set my passwords in the ~/.pgpass file so that the various psql
scripts can log in.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pg_dump from crontab
2006-08-04 07:20 pg_dump from crontab Nirav Parikh <niravp@alliancerecruitment.com.au>
@ 2006-08-10 19:04 ` Steve Crawford <scrawford@pinpointresearch.com>
3 siblings, 0 replies; 5+ messages in thread
From: Steve Crawford @ 2006-08-10 19:04 UTC (permalink / raw)
To: Nirav Parikh <niravp@alliancerecruitment.com.au>; +Cc: pgsql-admin
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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pg_dump from crontab
2006-08-04 07:20 pg_dump from crontab Nirav Parikh <niravp@alliancerecruitment.com.au>
@ 2006-08-11 06:06 ` Adam Radlowski <adamr@informatyka.gdansk.pl>
3 siblings, 0 replies; 5+ messages in thread
From: Adam Radlowski @ 2006-08-11 06:06 UTC (permalink / raw)
To: Nirav Parikh <niravp@alliancerecruitment.com.au>; +Cc: pgsql-admin
Try (do not use ">" output stream redirection, but "-f" switch):
0 20 * * 5 /usr/pgsql/bin/pg_dump -F c database -f
/usr/backup/friDATE4.pgdump
0 20 * * 4 pg_dump -F c database -f /usr/backup/thurDATE06-3.pgdump
Or instead (if it will not work):
1. Put those commands into root crontab file (/var/spool/cron/root)
2. Instead raw putting the commands into crontab file, put them into
scripts and run for them the shell - for example:
0 20 * * 5 /bin/sh /home/scripts/fri_date4.sh
0 20 * * 4 /bin/sh /home/scripts//thur_date06-3.sh
Into /home/scripts/fri_date4.sh You put line:
/usr/pgsql/bin/pg_dump -F c database -f /usr/backup/friDATE4.pgdump
Into /home/scripts//thur_date06-3.sh You put line:
pg_dump -F c database -f /usr/backup/thurDATE06-3.pgdump
Greetings
Adam
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?
>
>
>
>
> Regards*, *
>
> * *
>
> * *
>
> *Nirav*
>
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2006-08-11 06:06 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-08-04 07:20 pg_dump from crontab Nirav Parikh <niravp@alliancerecruitment.com.au>
2006-08-10 19:00 ` Ivo Rossacher <rossacher@bluewin.ch>
2006-08-10 19:03 ` Scott Marlowe <smarlowe@g2switchworks.com>
2006-08-10 19:04 ` Steve Crawford <scrawford@pinpointresearch.com>
2006-08-11 06:06 ` Adam Radlowski <adamr@informatyka.gdansk.pl>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox