Re: Running vacuum on cron

John Gateley <gateley@jriver.com>

From: gateley@jriver.com
To: Pedro Alves <pmalves@think.co.pt>
Cc: PostGreSQL <pgsql-general@postgresql.org>
Date: 2001-10-29T19:10:26Z
Lists: pgsql-general
Pedro Alves wrote:
> 
>         Hi. Is there any way to put a vacuum and a vacuum analyze (the
> second does everything the first does? Or do I need to use both?) in a cron
> so that it is executed nightly?

Use a crontab entry like:
0 3 * * * /usr/local/bin/psql -d <database> < /.../vacuum_analyze

make sure the crontab owner has permission to do a vacuum analyze.
Change the path of psql as appropriate.
And finally the file /.../vacuum_analyze should contain:
vacuum analyze \g
\q