Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id eB13A7F41292 for ; Thu, 30 Nov 2000 22:10:07 -0500 (EST) (envelope-from pgsql-general-owner@postgresql.org) Received: from rdms.pyr.ec.gc.ca (fwvan1.pyr.ec.gc.ca [199.212.20.2]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eARJSct68572; Mon, 27 Nov 2000 14:28:39 -0500 (EST) (envelope-from bernie.huang@ec.gc.ca) Received: from ec.gc.ca (IDENT:huangb@rdms.pyr.ec.gc.ca [131.235.150.90]) by rdms.pyr.ec.gc.ca (8.9.3/8.9.3) with ESMTP id LAA28867; Mon, 27 Nov 2000 11:22:47 -0800 Message-ID: <3A22B485.E8963417@ec.gc.ca> Date: Mon, 27 Nov 2000 11:22:45 -0800 From: Bernie Huang Organization: Environment Canada X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 To: PHP_DB , PHP_General , PGSQL-SQL , PGSQL-GENERAL Subject: a script that queries database periodically Content-Type: multipart/mixed; boundary="------------3FCD27714A3E2FEF2B5B9474" X-Archive-Number: 200011/1030 X-Sequence-Number: 1178 This is a multi-part message in MIME format. --------------3FCD27714A3E2FEF2B5B9474 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Hello, My boss wants me to write a script that will send a email report to him monthly with the result of database queries. For example, an email would be like: Monthly report +----------+---------+---------------+ | Vehicles | Mileage | # of Signouts | +----------+---------+---------------+ | Vehicle1 | 10324 | 5 | +----------+---------+---------------+ | Vehicle2 | 19384 | 6 | +----------+---------+---------------+ ... I was thinking of writing up a PHP script and put into crontab, which is somehow easier than a shell script, but PHP is an apache module, so I cannot execute PHP under crontab (it has to be executed in a browser right?). I guess a shell script is necessary. So, is it possible to call 'psql' and returning its query result and I can use sendmail to email the result? Any other idea? Thanks. - Bernie --------------3FCD27714A3E2FEF2B5B9474 Content-Type: text/x-vcard; charset=iso-8859-15; name="bernie.huang.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Bernie Huang Content-Disposition: attachment; filename="bernie.huang.vcf" begin:vcard n:Huang;Bernie tel;fax:(604)664-9195 tel;work:(604)664-9172 x-mozilla-html:TRUE org:Environment Canada;Standards and Technology Services adr:;;700-1200 West 73 Ave.;Vancouver;BC;V6P 6H9;Canada version:2.1 email;internet:bernie.huang@ec.gc.ca title:Programmer x-mozilla-cpt:;0 fn:Bernie Huang end:vcard --------------3FCD27714A3E2FEF2B5B9474--