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