Using psql on command line
I would like to run a cron job nightly to vaccuum a few databases, but how
do you execute from just a command line? I tried like:
psql mydb < vacuum
psql mydb | vacuum
etc.
Thanks.
Brian
--------------------------------------------------------------------------
Brian Feeny (BF304) | ShreveNet Inc. - Premium Internet Service Provider
Network Administrator | Shreveport, Louisiana - http://www.shreve.net/
signal@shreve.net | Web Hosting, Virtual Domains, Storefronts,
(318)222-2NET x 109 | Database/Web Integration, 56k, ISDN, T1
"Brian" == Brian <signal@shreve.net> writes:
Brian> I would like to run a cron job nightly to vaccuum a few
Brian> databases, but how do you execute from just a command line? I
Brian> tried like:
Brian>
Brian> psql mydb < vacuum
Brian> psql mydb | vacuum
One of
~$ echo "vacuum" | psql mydb
~$ psql mydb -c "vacuum"
Note that you'll have to be careful about the environment of the user
which is running the cron jobs (PGDATA etc).
--
Eric Marsden
emarsden @ mail.dotcom.fr
It's elephants all the way down
Import Notes
Reply to msg id not found: Brian'smessageofFri4Sep1998095816-0500CDT
you should look at the manual for psql.. thats what I just did.. looks
like it would be something like this..
psql -c vacuum <tablename> -d dbName
if you can't find the man file... try the postgres home page.
(www.postgresql.org) or look in pgsql/man/man1/ on your local system...
On Fri, 4 Sep 1998, Brian wrote:
Show quoted text
I would like to run a cron job nightly to vaccuum a few databases, but how
do you execute from just a command line? I tried like:psql mydb < vacuum
psql mydb | vacuumetc.
Thanks.
Brian
--------------------------------------------------------------------------
Brian Feeny (BF304) | ShreveNet Inc. - Premium Internet Service Provider
Network Administrator | Shreveport, Louisiana - http://www.shreve.net/
signal@shreve.net | Web Hosting, Virtual Domains, Storefronts,
(318)222-2NET x 109 | Database/Web Integration, 56k, ISDN, T1
Just test it.. worked like this..
psql -c 'vacuum table;' -d database
On Fri, 4 Sep 1998, Brian wrote:
Show quoted text
I would like to run a cron job nightly to vaccuum a few databases, but how
do you execute from just a command line? I tried like:psql mydb < vacuum
psql mydb | vacuumetc.
Thanks.
Brian
--------------------------------------------------------------------------
Brian Feeny (BF304) | ShreveNet Inc. - Premium Internet Service Provider
Network Administrator | Shreveport, Louisiana - http://www.shreve.net/
signal@shreve.net | Web Hosting, Virtual Domains, Storefronts,
(318)222-2NET x 109 | Database/Web Integration, 56k, ISDN, T1