Re: vacuumdb and pg_dump are not running under cron

From: "Jeff Lu" <jklcom(at)mindspring(dot)com>
To: "'Jason Tishler'" <jason(at)tishler(dot)net>
Cc: <pgsql-cygwin(at)postgresql(dot)org>
Subject: Re: vacuumdb and pg_dump are not running under cron
Date: 2003-05-12 16:29:50
Message-ID: 003501c318a3$b5f257c0$1501a8c0@DemoServer
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin


Jason,

Actually I do have these in a shell script file name "backupsys"
vacuumdb --username=jeff -h localhost jeffdb
pg_dump --username=jeff jeffdb >
> /c/progra~1/apache~1/apache/ intrapos/database/intrapos_shdw.dat
pg_ctl stop -m fast

My cron really looks like this:
9 12 * * * /c/progra~1/apache~1/apache/cgi-bin/backupsys

Thanks
-Jeff

-----Original Message-----
From: Jason Tishler [mailto:jason(at)tishler(dot)net]
Sent: Monday, May 12, 2003 12:11 PM
To: Jeff Lu
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: vacuumdb and pg_dump are not running under cron

Jeff,

On Mon, May 12, 2003 at 11:42:42AM -0400, Jeff Lu wrote:
> I set up a cron job to run vacuumdb and pg_dump periodically but they
> are not being run under cron. Under command line they worked fine.
>
> At first I thought the cron didn't get executed at all so I added
> shutdown to in my cron file:
>
> 9 12 * * * vacuumdb --username=jeff -h localhost jeffdb
> 9 12 * * * pg_dump --username=jeff jeffdb >
> /c/progra~1/apache~1/apache/ intrapos/database/intrapos_shdw.dat
> 9 12 * * * pg_ctl stop -m fast

Shouldn't the above be in a shell script? In this way, the commands
will be executed sequentially. Executing them concurrently does not
seem to be what you intended.

> 9 12 * * * shutdown --force --shutdown 10

The above is a harsh way to determine whether or not cron is working. I
would use the following test instead:

*/1 * * * * date >>/tmp/date.txt

> The system got shutdown but the database didn't get stopped, vaccumdb
> and pg_dump did not get executed
>
> Can someone tell me why that is?

See above.

To further debug this problem, I would do one of the following:

1. set up ssmtp and set MAILTO as appropriate
2. redirect stdout and stderr to a log file

so cron can inform you of any output (i.e., errors) from the cron jobs.

BTW, what user is the crontab running under? Is it the same one as used
during the command line testing?

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6

In response to

Responses

Browse pgsql-cygwin by date

  From Date Subject
Next Message Jason Tishler 2003-05-12 16:39:29 Re: UPDATE 2: Windows XP, Cygwin 1.3.22-1, PostgreSQL 7.3.2,
Previous Message Jason Tishler 2003-05-12 16:10:59 Re: vacuumdb and pg_dump are not running under cron