Re: pg dump.. issue with when using crontab - Mailing list pgsql-general

From Tom Lane
Subject Re: pg dump.. issue with when using crontab
Date
Msg-id 14962.1264526046@sss.pgh.pa.us
Whole thread Raw
In response to pg dump.. issue with when using crontab  (Moe <mohamed5432154321@gmail.com>)
Responses Re: pg dump.. issue with when using crontab
List pgsql-general
Moe <mohamed5432154321@gmail.com> writes:
> I have a simple script file db :
> #!/bin/bash
> pg_dump -U postgres prodDB > /var/a/db/$(date "+%Y-%m-%d_%H:%M")-prodDB.dump

> Which works fine when executed manually ( ./db ).. I get a dump file which
> is around 1.9 MB

> I run this script from the crontab schedueler (crontab -e) :

> # m h  dom mon dow   command
> 33 04 * * * /var/a/scripts/db

> Which appears to executing the script file, but what I get is zero sized
> dump files.

cron jobs typically run with a very minimal PATH.  I'll bet pg_dump
isn't in it.  Try putting the full path to pg_dump in the script.

Also consider sending its stderr someplace more useful than /dev/null,
so that you're not flying blind while debugging problems ...

            regards, tom lane

pgsql-general by date:

Previous
From: Keresztury Balázs
Date:
Subject: create role in a pl/pgsql trigger
Next
From: Moe
Date:
Subject: Re: pg dump.. issue with when using crontab