X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 97D51DA7C1 for ; Thu, 22 Sep 2005 11:26:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79352-09 for ; Thu, 22 Sep 2005 14:26:26 +0000 (GMT) Received: from matrix.gatewaynet.com (matrix.gatewaynet.com [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id 50527DA7BF for ; Thu, 22 Sep 2005 11:26:27 -0300 (ADT) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id j8MEJV2n022382; Thu, 22 Sep 2005 17:19:31 +0300 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id j8MEJVYm022378; Thu, 22 Sep 2005 17:19:31 +0300 Date: Thu, 22 Sep 2005 17:19:31 +0300 (EEST) From: Achilleus Mantzios To: =?ISO-8859-1?Q?=22Michael_H=F6ller=22?= Cc: pgsql-sql@postgresql.org Subject: Re: postgres on the comman line In-Reply-To: <1EIRYH-16Qhai0@fwd29.aul.t-online.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 required=5 tests=[AWL=0.008] X-Spam-Level: X-Archive-Number: 200509/205 X-Sequence-Number: 22752 O "Michael Höller" Ýãñáøå óôéò Sep 22, 2005 : > > > Hello, > > I like to automate a daily check and like to run select statement via > cron but this seems to be more tricky than I thought.... > > I tried the following: > su postgres -c "select count(*) from TABLE where xxxxxx;" Firstoff, 'select' is nor a unix command, neither a postgresql program. So you need something like: su postgres -c "psql -c 'select count(*) from TABLE where xxxxxx'" If you are the only one with an account on the machine then you might try to tweak ~postgres/data/pg_hba.conf and set method 'trust' for local access (no tcpip,psql without the -h option) . Also you could set env variables PGPASSWORD, PGUSER. > > I have the probelm that I am allways asked for the password - I did not > find a way how to pass the password. > > Also I like to direct the result to a file, I assume I can do this via > > but not haveing passed the first problem I did not check this. > > I am happy for every hint > > Thanks a lot > Michael > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > -- -Achilleus