Re: vacuumdb and pg_dump are not running under cron - Mailing list pgsql-cygwin

From Jeff Lu
Subject Re: vacuumdb and pg_dump are not running under cron
Date
Msg-id 003501c318a3$b5f257c0$1501a8c0@DemoServer
Whole thread Raw
In response to Re: vacuumdb and pg_dump are not running under cron  (Jason Tishler <jason@tishler.net>)
List 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@tishler.net]
Sent: Monday, May 12, 2003 12:11 PM
To: Jeff Lu
Cc: pgsql-cygwin@postgresql.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


pgsql-cygwin by date:

Previous
From: "Jeff Lu"
Date:
Subject: vacuumdb and pg_dump are not running under cron
Next
From: "Jeff Lu"
Date:
Subject: Re: vacuumdb and pg_dump are not running under cron