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 CE80CDA78A for ; Thu, 22 Sep 2005 11:14:54 -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 82366-01 for ; Thu, 22 Sep 2005 14:14:48 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by svr1.postgresql.org (Postfix) with ESMTP id 61069DA795 for ; Thu, 22 Sep 2005 11:14:49 -0300 (ADT) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de with ESMTP (Nemesis), id 0ML2ov-1EIRqf0CrU-00058B; Thu, 22 Sep 2005 16:14:53 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1EIRqs-0004w5-00 for pgsql-sql@postgresql.org; Thu, 22 Sep 2005 16:15:06 +0200 Date: Thu, 22 Sep 2005 16:15:06 +0200 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: Re: postgres on the comman line Message-ID: <20050922141506.GE12957@webserv.wug-glas.de> Mail-Followup-To: "A. Kretschmer" , pgsql-sql@postgresql.org References: <1EIRYH-16Qhai0@fwd29.aul.t-online.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1EIRYH-16Qhai0@fwd29.aul.t-online.de> X-DEST: 208 X-MSMail-Priority: High X-Message-Flag: Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) X-OS: Linux - weil ich es mir Wert bin! X-Info: registrierter Linux-User 97922 http://counter.li.org User-Agent: mutt-ng 1.5.9i (Linux) X-Provags-ID: kundenserver.de abuse@kundenserver.de login:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.292 required=5 tests=[AWL=0.025, MISSING_MIMEOLE=0, X_MSMAIL_PRIORITY_HIGH=0.267] X-Spam-Level: X-Archive-Number: 200509/204 X-Sequence-Number: 22751 am 22.09.2005, um 15:55:53 +0200 mailte "Michael Höller" folgendes: > > > 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;" - run the cron direcly as postgres - echo "select foo from bar" | psql ... or: write your sql-query i a file and "psql -f file" > > I have the probelm that I am allways asked for the password - I did not > find a way how to pass the password. put it in the ~/.psqlrc > > Also I like to direct the result to a file, I assume I can do this via > yes, this is possible. Regards, Andreas -- Andreas Kretschmer (Kontakt: siehe Header) Heynitz: 035242/47212, D1: 0160/7141639 GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net === Schollglas Unternehmensgruppe ===