Re: pg dump.. issue with when using crontab

From: APseudoUtopia <apseudoutopia(at)gmail(dot)com>
To: Moe <mohamed5432154321(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pg dump.. issue with when using crontab
Date: 2010-01-26 17:07:15
Message-ID: 27ade5281001260907w4c0e43e4r494aacf5d4213afd@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 26, 2010 at 11:54 AM, Moe <mohamed5432154321(at)gmail(dot)com> wrote:
> Hi folks,
>
> 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.
> So perhaps it is some use access that is limiting crontab, making it not run
> as root.
>
> How can I fix this to work with crontab ? I am thinking that I should change
> :
> pg_dump -U postgres prodDB > /var/a/db/$(date "+%Y-%m-%d_%H:%M")-prodDB.dump
>
> Thank you in advance / Moe
>

Inside your script, try giving the full path to pg_dump. Cron
generally resets your $PATH.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Keresztury Balázs 2010-01-26 17:09:43 create role in a pl/pgsql trigger
Previous Message Moe 2010-01-26 16:54:31 pg dump.. issue with when using crontab