X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 70F6C9FB2F8 for ; Thu, 10 Aug 2006 16:04:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 43788-04 for ; Thu, 10 Aug 2006 16:04:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 2139A9FB2FA for ; Thu, 10 Aug 2006 16:04:28 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from polaris.pinpointresearch.com (66-7-238-130.static-ip.telepacific.net [66.7.238.130]) by svr4.postgresql.org (Postfix) with ESMTP id 1C6DE5AF027 for ; Thu, 10 Aug 2006 19:04:27 +0000 (GMT) Received: from [192.168.1.179] (betelgeuse.pinpointresearch.com [192.168.1.179]) by polaris.pinpointresearch.com (Postfix) with ESMTP id 718CEEA2BEFB; Thu, 10 Aug 2006 12:04:25 -0700 (PDT) Message-ID: <44DB8339.4030206@pinpointresearch.com> Date: Thu, 10 Aug 2006 12:04:25 -0700 From: Steve Crawford User-Agent: Thunderbird 1.5.0.5 (X11/20060725) MIME-Version: 1.0 To: Nirav Parikh Cc: pgsql-admin@postgresql.org Subject: Re: pg_dump from crontab References: <221385EC3F18A44DB0925467A1D2395F568D6D@exsrv3.workskillsprofessionals.com.au> In-Reply-To: <221385EC3F18A44DB0925467A1D2395F568D6D@exsrv3.workskillsprofessionals.com.au> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.168 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200608/147 X-Sequence-Number: 22690 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