pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feeda script that queries database periodically
18+ messages / 15 participants
[nested] [flat]
* a script that queries database periodically
@ 2000-11-27 19:22 Bernie Huang <bernie.huang@ec.gc.ca>
2000-11-27 19:38 ` Re: [PHP] a script that queries database periodically Folke Ashberg <folke@fanstage.de>
2000-11-27 19:44 ` Re: [SQL] a script that queries database periodically Brett W. McCoy <bmccoy@chapelperilous.net>
2000-11-27 19:44 ` Re: [SQL] a script that queries database periodically Mathijs Brands <mathijs@ilse.nl>
2000-11-27 19:54 ` Re: [PHP] a script that queries database periodically Jason <jason@jnj.org>
2000-11-27 20:31 ` Re: a script that queries database periodically Serge Canizares <serge@ephilosopher.com>
2000-11-27 21:44 ` Re: [SQL] a script that queries database periodically Poul L. Christiansen <poulc@cs.auc.dk>
2000-11-27 22:24 ` Re: [SQL] a script that queries database periodically Peter Eisentraut <peter_e@gmx.net>
2000-11-30 18:16 ` RE: [SQL] a script that queries database periodically Wojciech Milek <wojciech.milek@demo.pl>
0 siblings, 8 replies; 18+ messages in thread
From: Bernie Huang @ 2000-11-27 19:22 UTC (permalink / raw)
To: PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
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
Attachments:
bernie.huang.vcf (text/x-vcard, 314B) download
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
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [PHP] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
@ 2000-11-27 19:38 ` Folke Ashberg <folke@fanstage.de>
7 siblings, 0 replies; 18+ messages in thread
From: Folke Ashberg @ 2000-11-27 19:38 UTC (permalink / raw)
To: Bernie Huang <bernie.huang@ec.gc.ca>; +Cc: PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
Hi!
I think you have installed GET , so use in your cronab
GET http://localhost/report_for_my_boss/create.php |mail -s "Hello Boss"
boss@chief.net
if you miss get try it with lynx:
lynx -source -dump http://localhost/.. |mail ....
regards
Folke
--
Folke Ashberg
Stage Internet Services GmbH
Technical Development
folke@fanstage.de
folke@fanstage.de | Tel: +49 89 454591-77 | Fax: +49 89 454591-71
Kreillerstr. 21 | 81673 Munich | Germany | www.fanstage.de
On Mon, 27 Nov 2000, Bernie Huang wrote:
> 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
>
>
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
@ 2000-11-27 19:44 ` Brett W. McCoy <bmccoy@chapelperilous.net>
7 siblings, 0 replies; 18+ messages in thread
From: Brett W. McCoy @ 2000-11-27 19:44 UTC (permalink / raw)
To: Bernie Huang <bernie.huang@ec.gc.ca>; +Cc: PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
On Mon, 27 Nov 2000, Bernie Huang wrote:
> 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?
Is there any reason to not use Perl & DBI or the Pg.pm module?
Brett W. McCoy
http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
Exhilaration is that feeling you get just after a great idea hits you,
and just before you realize what is wrong with it.
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
@ 2000-11-27 19:44 ` Mathijs Brands <mathijs@ilse.nl>
7 siblings, 0 replies; 18+ messages in thread
From: Mathijs Brands @ 2000-11-27 19:44 UTC (permalink / raw)
To: Bernie Huang <bernie.huang@ec.gc.ca>; +Cc: PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
On Mon, Nov 27, 2000 at 11:22:45AM -0800, Bernie Huang allegedly wrote:
> 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
Sure you can. You can configure PHP to run seperately from any webserver.
You would then be able to write PHP scripts that can be used just like any
other UNIX scripts, for instance from a crontab.
I don't know if you've configured and built PHP before, but it is actually
not that difficult. However, be sure to look at the INSTALL file that comes
with PHP. What it comes down to is probably the following:
1 - extract PHP source
2 - change to the PHP source directory and execute the following configure
command:
./configure --prefix=/usr/local/standalone-php --without-mysql --with-pgsql
3 - build the source by giving the make command
4 - do a 'make install' after PHP has been succesfully build
A bit off-topic, but I hope this is helpful.
Cheers,
Mathijs
Ps. I just thought of something else. You could write a PHP script that runs
under apache (like your're used to) and request it with wget, lynx or a
similar tool from a crontab. That way you wouldn't need to configure a new
PHP installation.
--
"A book is a fragile creature. It suffers the wear of time,
it fears rodents, the elements, clumsy hands."
Umberto Eco
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [PHP] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
@ 2000-11-27 19:54 ` Jason <jason@jnj.org>
2000-12-01 12:22 ` Re: Re: [PHP] a script that queries database periodically Miles Thompson <milesthompson@sprint.ca>
7 siblings, 1 reply; 18+ messages in thread
From: Jason @ 2000-11-27 19:54 UTC (permalink / raw)
To: Bernie Huang <bernie.huang@ec.gc.ca>; +Cc: PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
> 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?
if you know perl, you should check out DBI. Read all about it at
www.cpan.org. It's pretty similar to the php database interface.
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Re: [PHP] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
2000-11-27 19:54 ` Re: [PHP] a script that queries database periodically Jason <jason@jnj.org>
@ 2000-12-01 12:22 ` Miles Thompson <milesthompson@sprint.ca>
0 siblings, 0 replies; 18+ messages in thread
From: Miles Thompson @ 2000-12-01 12:22 UTC (permalink / raw)
To: Jason <jason@jnj.org>; +Cc: Bernie Huang <bernie.huang@ec.gc.ca>; PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
Jason's definitiely on the right track.
I'd add that if you don'tknow Perl, Python might be easier. Check
http://sourceforge.net/forum/forum.php?forum_id=39069, starship.net might also
have a PostreSQL module.
Python also has a very easy to use SMTP module for mailing of reports.
There's nothing anti-Perl here, I just don't know that language and found
Python quite natural.
Miles Thompson
RE
Jason wrote:
> > 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?
>
> if you know perl, you should check out DBI. Read all about it at
> www.cpan.org. It's pretty similar to the php database interface.
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
@ 2000-11-27 20:31 ` Serge Canizares <serge@ephilosopher.com>
7 siblings, 0 replies; 18+ messages in thread
From: Serge Canizares @ 2000-11-27 20:31 UTC (permalink / raw)
To: Bernie Huang <bernie.huang@ec.gc.ca>; pgsql-sql
Why not use perl with DBI? If you know php, perl is just as easy.
Bernie Huang wrote:
> 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?).
>
> Thanks.
>
> - Bernie
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
@ 2000-11-27 21:44 ` Poul L. Christiansen <poulc@cs.auc.dk>
2000-11-27 21:56 ` Re: [SQL] a script that queries database periodically Roberto Mello <rmello@cc.usu.edu>
2000-11-27 23:06 ` Re: [SQL] a script that queries database periodically Mathijs Brands <mathijs@ilse.nl>
7 siblings, 2 replies; 18+ messages in thread
From: Poul L. Christiansen @ 2000-11-27 21:44 UTC (permalink / raw)
To: Bernie Huang <bernie.huang@ec.gc.ca>; +Cc: PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
I have a bash script in crontab with the following line:
"lynx -dump
http://127.0.0.1/postgres/myPhpFile.php>${currentDir}php_output.html"
You can also just put that line directly into crontab.
Poul L. Christiansen
Bernie Huang wrote:
> 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
>
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
2000-11-27 21:44 ` Re: [SQL] a script that queries database periodically Poul L. Christiansen <poulc@cs.auc.dk>
@ 2000-11-27 21:56 ` Roberto Mello <rmello@cc.usu.edu>
2000-11-27 22:36 ` Re: [PHP-DB] Re: [SQL] a script that queries database periodically Jason <jason@jnj.org>
1 sibling, 1 reply; 18+ messages in thread
From: Roberto Mello @ 2000-11-27 21:56 UTC (permalink / raw)
To: Poul L. Christiansen <poulc@cs.auc.dk>; +Cc: Bernie Huang <bernie.huang@ec.gc.ca>; PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
"Poul L. Christiansen" wrote:
> > 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?
PHP does not have a scheduling facility? AOLserver (the web/application
server that powers AOL) has had such facility (and many many others for
db-backed websites) since 1995. ns_schedule_proc.
http://www.aolserver.com
-Roberto
--
Computer Science Utah State University
Space Dynamics Laboratory Web Developer
USU Free Software & GNU/Linux Club http://fslc.usu.edu
My home page - http://www.brasileiro.net/roberto
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [PHP-DB] Re: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
2000-11-27 21:44 ` Re: [SQL] a script that queries database periodically Poul L. Christiansen <poulc@cs.auc.dk>
2000-11-27 21:56 ` Re: [SQL] a script that queries database periodically Roberto Mello <rmello@cc.usu.edu>
@ 2000-11-27 22:36 ` Jason <jason@jnj.org>
2000-11-28 00:10 ` Re: [PHP-DB] Re: [SQL] a script that queries database periodically Roberto Mello <rmello@cc.usu.edu>
0 siblings, 1 reply; 18+ messages in thread
From: Jason @ 2000-11-27 22:36 UTC (permalink / raw)
To: Roberto Mello <rmello@cc.usu.edu>; +Cc: Poul L. Christiansen <poulc@cs.auc.dk>; Bernie Huang <bernie.huang@ec.gc.ca>; PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
On Mon, Nov 27, 2000 at 02:56:59PM -0700, Roberto Mello wrote:
>
> PHP does not have a scheduling facility? AOLserver (the web/application
> server that powers AOL) has had such facility (and many many others for
> db-backed websites) since 1995. ns_schedule_proc.
> http://www.aolserver.com
aolserver is a web/application server. PHP is a server-side scripting
language. Why exactly *should* it have a job scheduler?
Some (such as myself) might also ask why should a web server have a job
scheduler, but that's a thread for a different list :)
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [PHP-DB] Re: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
2000-11-27 21:44 ` Re: [SQL] a script that queries database periodically Poul L. Christiansen <poulc@cs.auc.dk>
2000-11-27 21:56 ` Re: [SQL] a script that queries database periodically Roberto Mello <rmello@cc.usu.edu>
2000-11-27 22:36 ` Re: [PHP-DB] Re: [SQL] a script that queries database periodically Jason <jason@jnj.org>
@ 2000-11-28 00:10 ` Roberto Mello <rmello@cc.usu.edu>
2000-11-28 00:30 ` Re: [PHP-DB] Re: [SQL] a script that queries database periodically clayton cottingham <clayton@marketingchallenge.com>
2000-11-28 00:45 ` Re: [PHP] Re: [PHP-DB] Re: [SQL] a script that queries database periodically Joe Stump <joe@earth.care2.com>
2000-12-04 07:56 ` Re: Re: [PHP-DB] Re: [SQL] a script that queries database periodically Dan Wilson <phpPgAdmin@acucore.com>
0 siblings, 3 replies; 18+ messages in thread
From: Roberto Mello @ 2000-11-28 00:10 UTC (permalink / raw)
To: Jason <jason@jnj.org>; +Cc: Poul L. Christiansen <poulc@cs.auc.dk>; Bernie Huang <bernie.huang@ec.gc.ca>; PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
Jason wrote:
>
> aolserver is a web/application server. PHP is a server-side scripting
> language. Why exactly *should* it have a job scheduler?
>
> Some (such as myself) might also ask why should a web server have a job
> scheduler, but that's a thread for a different list :)
Because PHP is supposed to solve web development problems. And this is
one of them. It's very useful.
-Roberto
--
Computer Science Utah State University
Space Dynamics Laboratory Web Developer
USU Free Software & GNU/Linux Club http://fslc.usu.edu
My home page - http://www.brasileiro.net/roberto
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [PHP-DB] Re: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
2000-11-27 21:44 ` Re: [SQL] a script that queries database periodically Poul L. Christiansen <poulc@cs.auc.dk>
2000-11-27 21:56 ` Re: [SQL] a script that queries database periodically Roberto Mello <rmello@cc.usu.edu>
2000-11-27 22:36 ` Re: [PHP-DB] Re: [SQL] a script that queries database periodically Jason <jason@jnj.org>
2000-11-28 00:10 ` Re: [PHP-DB] Re: [SQL] a script that queries database periodically Roberto Mello <rmello@cc.usu.edu>
@ 2000-11-28 00:30 ` clayton cottingham <clayton@marketingchallenge.com>
2 siblings, 0 replies; 18+ messages in thread
From: clayton cottingham @ 2000-11-28 00:30 UTC (permalink / raw)
To: Roberto Mello <rmello@cc.usu.edu>; +Cc: Jason <jason@jnj.org>; Poul L. Christiansen <poulc@cs.auc.dk>; Bernie Huang <bernie.huang@ec.gc.ca>; PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
Roberto Mello wrote:
>
> Jason wrote:
> >
> > aolserver is a web/application server. PHP is a server-side scripting
> > language. Why exactly *should* it have a job scheduler?
> >
> > Some (such as myself) might also ask why should a web server have a job
> > scheduler, but that's a thread for a different list :)
>
> Because PHP is supposed to solve web development problems. And this is
> one of them. It's very useful.
>
> -Roberto
> --
> Computer Science Utah State University
> Space Dynamics Laboratory Web Developer
> USU Free Software & GNU/Linux Club http://fslc.usu.edu
> My home page - http://www.brasileiro.net/roberto
heya,
IMHO
it depends on why you are querying the db
if you need internet access data
such as how fast its querying or what have you
then yes php could be useful
if you need reports generated and mailed to someone
a crond shell script would seem more logical
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [PHP] Re: [PHP-DB] Re: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
2000-11-27 21:44 ` Re: [SQL] a script that queries database periodically Poul L. Christiansen <poulc@cs.auc.dk>
2000-11-27 21:56 ` Re: [SQL] a script that queries database periodically Roberto Mello <rmello@cc.usu.edu>
2000-11-27 22:36 ` Re: [PHP-DB] Re: [SQL] a script that queries database periodically Jason <jason@jnj.org>
2000-11-28 00:10 ` Re: [PHP-DB] Re: [SQL] a script that queries database periodically Roberto Mello <rmello@cc.usu.edu>
@ 2000-11-28 00:45 ` Joe Stump <joe@earth.care2.com>
2 siblings, 0 replies; 18+ messages in thread
From: Joe Stump @ 2000-11-28 00:45 UTC (permalink / raw)
To: Roberto Mello <rmello@cc.usu.edu>; +Cc: Jason <jason@jnj.org>; Poul L. Christiansen <poulc@cs.auc.dk>; Bernie Huang <bernie.huang@ec.gc.ca>; PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
> Because PHP is supposed to solve web development problems. And this is
> one of them. It's very useful.
Why solve one that is already solved? PHP isn't here to reinvent the wheel -
get crontab and quit crying.
--Joe
>
> -Roberto
> --
> Computer Science Utah State University
> Space Dynamics Laboratory Web Developer
> USU Free Software & GNU/Linux Club http://fslc.usu.edu
> My home page - http://www.brasileiro.net/roberto
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
================================================================================
= Joe Stump joestump98@yahoo.com http://www.miester.org =
================================================================================
Need a programmer? http://www.google.com/search?q=joe+stump+resume
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Re: [PHP-DB] Re: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
2000-11-27 21:44 ` Re: [SQL] a script that queries database periodically Poul L. Christiansen <poulc@cs.auc.dk>
2000-11-27 21:56 ` Re: [SQL] a script that queries database periodically Roberto Mello <rmello@cc.usu.edu>
2000-11-27 22:36 ` Re: [PHP-DB] Re: [SQL] a script that queries database periodically Jason <jason@jnj.org>
2000-11-28 00:10 ` Re: [PHP-DB] Re: [SQL] a script that queries database periodically Roberto Mello <rmello@cc.usu.edu>
@ 2000-12-04 07:56 ` Dan Wilson <phpPgAdmin@acucore.com>
2 siblings, 0 replies; 18+ messages in thread
From: Dan Wilson @ 2000-12-04 07:56 UTC (permalink / raw)
To: Roberto Mello <rmello@cc.usu.edu>; Jason <jason@jnj.org>; +Cc: Poul L. Christiansen <poulc@cs.auc.dk>; Bernie Huang <bernie.huang@ec.gc.ca>; PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
> Jason wrote:
> >
> > aolserver is a web/application server. PHP is a server-side scripting
> > language. Why exactly *should* it have a job scheduler?
> >
> > Some (such as myself) might also ask why should a web server have a job
> > scheduler, but that's a thread for a different list :)
>
> Because PHP is supposed to solve web development problems. And this is
> one of them. It's very useful.
I disagree! Cronjobs are not a web development problem. That is something
that should be handled on the server/machine side. PHP is purely designed
to dynamically create web pages. It has other things built into it, but
each one interfaces with the web page somehow. A cronjob doesn't use the
web at all. The web is an interactive thing and the whole purpose of a job
scheduler is to avoid interaction.
Sure a job scheduler is useful, but it is outside the scope and mission of
PHP.
-Dan
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
2000-11-27 21:44 ` Re: [SQL] a script that queries database periodically Poul L. Christiansen <poulc@cs.auc.dk>
@ 2000-11-27 23:06 ` Mathijs Brands <mathijs@ilse.nl>
1 sibling, 0 replies; 18+ messages in thread
From: Mathijs Brands @ 2000-11-27 23:06 UTC (permalink / raw)
To: Poul L. Christiansen <poulc@cs.auc.dk>; +Cc: Bernie Huang <bernie.huang@ec.gc.ca>; PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
On Mon, Nov 27, 2000 at 10:44:39PM +0100, Poul L. Christiansen allegedly wrote:
> I have a bash script in crontab with the following line:
> "lynx -dump
> http://127.0.0.1/postgres/myPhpFile.php>${currentDir}php_output.html"
>
> You can also just put that line directly into crontab.
>
> Poul L. Christiansen
Be sure to redirect the output of the command in your crontab to /dev/null
or something similar. If you don't, the output (HTML) will be emailed to
you each time the script is run. Whether this side effect is desirable is
of course up to you (or your boss, for instance).
Getting even more off-topic,
Mathijs
--
"Where is human nature so weak as in a bookstore!"
Henry Ward Beecher (1813-1887)
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
@ 2000-11-27 22:24 ` Peter Eisentraut <peter_e@gmx.net>
7 siblings, 0 replies; 18+ messages in thread
From: Peter Eisentraut @ 2000-11-27 22:24 UTC (permalink / raw)
To: Bernie Huang <bernie.huang@ec.gc.ca>; +Cc: PGSQL-GENERAL <pgsql-general@postgresql.org>
Bernie Huang writes:
> My boss wants me to write a script that will send a email report to him
> monthly with the result of database queries.
> 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?
Conceptually, what you want is something like this:
#! /bin/sh
(
echo "Here's your report:"
psql -c 'SELECT ...'
) | mail -s Subject foo@bar
Reading man pages on each of these is advisable.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
^ permalink raw reply [nested|flat] 18+ messages in thread
* RE: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
@ 2000-11-30 18:16 ` Wojciech Milek <wojciech.milek@demo.pl>
2000-11-30 11:41 ` Re: [PHP] RE: [SQL] a script that queries database periodically JB <jbeebe@aimsmarketing.com>
7 siblings, 1 reply; 18+ messages in thread
From: Wojciech Milek @ 2000-11-30 18:16 UTC (permalink / raw)
To: Bernie Huang <bernie.huang@ec.gc.ca>; PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
Hi!
You can compile PHP without HTTP server support then you get php exec
'shell'
and:
#!/usr/local/bin/php
<?
echo "hello!";
?>
> -----Original Message-----
> From: pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Bernie Huang
> Sent: Monday, November 27, 2000 8:23 PM
> To: PHP_DB; PHP_General; PGSQL-SQL; PGSQL-GENERAL
> Subject: [SQL] a script that queries database periodically
>
>
> 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
>
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: [PHP] RE: [SQL] a script that queries database periodically
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
2000-11-30 18:16 ` RE: [SQL] a script that queries database periodically Wojciech Milek <wojciech.milek@demo.pl>
@ 2000-11-30 11:41 ` JB <jbeebe@aimsmarketing.com>
0 siblings, 0 replies; 18+ messages in thread
From: JB @ 2000-11-30 11:41 UTC (permalink / raw)
To: PHP_DB <php-db@lists.php.net>; PHP_General <php-general@lists.php.net>; pgsql-sql; PGSQL-GENERAL <pgsql-general@postgresql.org>
I'm sure the convience of having the reports emailed on a specific day is
what you're looking for. But why not just code your PHP to do your
mysql_query() and mail() and place it on a webserver. Obviously have a
simple hardcoded login so just not anyone can request the reports. That way
your boss can get the goods whenever, maybe he might need them mid-month or
something comes up. He'll be able to go to the URL, enter his name and pw
and hit submit and he has them.
Not like this answered your question, just a suggestion to make it easier if
a web gateway is an option.
----- Original Message -----
From: Wojciech Milek <wojciech.milek@demo.pl>
To: Bernie Huang <bernie.huang@ec.gc.ca>; PHP_DB <php-db@lists.php.net>;
PHP_General <php-general@lists.php.net>; PGSQL-SQL
<pgsql-sql@postgresql.org>; PGSQL-GENERAL <pgsql-general@postgresql.org>
Sent: Thursday, November 30, 2000 6:16 PM
Subject: [PHP] RE: [SQL] a script that queries database periodically
> Hi!
>
> You can compile PHP without HTTP server support then you get php exec
> 'shell'
>
> and:
>
> #!/usr/local/bin/php
> <?
>
>
> echo "hello!";
>
> ?>
>
> > -----Original Message-----
> > From: pgsql-sql-owner@postgresql.org
> > [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Bernie Huang
> > Sent: Monday, November 27, 2000 8:23 PM
> > To: PHP_DB; PHP_General; PGSQL-SQL; PGSQL-GENERAL
> > Subject: [SQL] a script that queries database periodically
> >
> >
> > 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
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
^ permalink raw reply [nested|flat] 18+ messages in thread
end of thread, other threads:[~2000-12-04 07:56 UTC | newest]
Thread overview: 18+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-11-27 19:22 a script that queries database periodically Bernie Huang <bernie.huang@ec.gc.ca>
2000-11-27 19:38 ` Folke Ashberg <folke@fanstage.de>
2000-11-27 19:44 ` Brett W. McCoy <bmccoy@chapelperilous.net>
2000-11-27 19:44 ` Mathijs Brands <mathijs@ilse.nl>
2000-11-27 19:54 ` Jason <jason@jnj.org>
2000-12-01 12:22 ` Miles Thompson <milesthompson@sprint.ca>
2000-11-27 20:31 ` Serge Canizares <serge@ephilosopher.com>
2000-11-27 21:44 ` Poul L. Christiansen <poulc@cs.auc.dk>
2000-11-27 21:56 ` Roberto Mello <rmello@cc.usu.edu>
2000-11-27 22:36 ` Jason <jason@jnj.org>
2000-11-28 00:10 ` Roberto Mello <rmello@cc.usu.edu>
2000-11-28 00:30 ` clayton cottingham <clayton@marketingchallenge.com>
2000-11-28 00:45 ` Joe Stump <joe@earth.care2.com>
2000-12-04 07:56 ` Dan Wilson <phpPgAdmin@acucore.com>
2000-11-27 23:06 ` Mathijs Brands <mathijs@ilse.nl>
2000-11-27 22:24 ` Peter Eisentraut <peter_e@gmx.net>
2000-11-30 18:16 ` Wojciech Milek <wojciech.milek@demo.pl>
2000-11-30 11:41 ` JB <jbeebe@aimsmarketing.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox