Nicolas Huillard wrote:
>
> Thanks for this very simple and beautiful line !
> You could simplify it by only having :
> 02 0 * * * echo "vacuum verbose;" | psql faq
>
> Frankly, I'd prefer a script that automatically adapt to any added database in the
>whole system : as an administrator, I don't want to edit my/postgres crontab each
>time a new DB is added to Postgres...
I use the following crontab entry here (one line):
03 0 * * * psql -t -c "select datname from pg_database" template1 |
xargs -n 1 psql -q -c "vacuum analyze"
This pulls out all database names in simplified format (no header and no
count), pipes it to the command splitter xargs, which executes a quite
mode psql VACUUM for each database output by the first psql. Syntax to
xargs is tricky here -- it is in fact nonobvious that the simplest
syntax is the correct syntax. If you want some output e-mailed to you,
strip out the -q, and add verbose to the vacuum ("vacuum verbose
analyze").
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11
************