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 20C02D902F for ; Thu, 22 Sep 2005 11:12:06 -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 79913-04 for ; Thu, 22 Sep 2005 14:11:55 +0000 (GMT) Received: from mail.rp-online.de (mail.rp-online.de [149.221.1.199]) by svr1.postgresql.org (Postfix) with ESMTP id D22AADA784 for ; Thu, 22 Sep 2005 11:11:56 -0300 (ADT) Received: from mail1 (localhost [127.0.0.1]) by localhost.rp-online.de (Postfix) with SMTP id 88F2B1FB16; Thu, 22 Sep 2005 16:12:00 +0200 (CEST) Received: from idefix.d.rp-online.de (idefix.d.rp-online.de [149.221.100.194]) by mail.rp-online.de (Postfix) with ESMTP id 5BEB71FB13; Thu, 22 Sep 2005 16:12:00 +0200 (CEST) From: Thomas Pundt Reply-To: Thomas Pundt Organization: RP Online Verlagsgesellschaft mbH To: pgsql-sql@postgresql.org, "Michael =?utf-8?q?H=C3=B6ller?=" Subject: Re: postgres on the comman line Date: Thu, 22 Sep 2005 16:13:10 +0200 User-Agent: KMail/1.8.2 References: <1EIRYH-16Qhai0@fwd29.aul.t-online.de> In-Reply-To: <1EIRYH-16Qhai0@fwd29.aul.t-online.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200509221613.10501.mlists@rp-online.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200509/203 X-Sequence-Number: 22750 Hi Michael, On Thursday 22 September 2005 15:55, Michael H=F6ller wrote: | 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;" you mean=20 su - postgres -c "echo 'select count(*) from TABLE where xxxxxx;'|psql" ? | I have the probelm that I am allways asked for the password - I did not | find a way how to pass the password. search the documentation for the .pgpass file. It should contain lines=20 with colon separated values consisting of host:port:database:user:password and must not be world-readable. | 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. yes. Ciao, Thomas =2D-=20 Thomas Pundt ---- http://rp-online.de/ ----