RE: [PHP] scheduled tasks

2003-06-06 Thread Jay Blanchard
[snip]
Does anyone know if there is any other way to have a php script run
automatically (everyday, or week, or month, etc...) besides a cron job
or scheduled task?  Thanks.
[/snip]

I suppose that you could run a script with a sleep statement for x time,
the re-direct to itself restarting the sleep statement. Hmmm?

Jay

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] scheduled tasks

2003-06-06 Thread Mark
If the issue is running a cron job on the server, you could run the
cron job or scheduled task on a client with lynx. The client would
just need to be on and have access to the server at the time it fires
up the task.

--- Matt Palermo [EMAIL PROTECTED] wrote:
 Does anyone know if there is any other way to have a php script run
 automatically (everyday, or week, or month, etc...) besides a cron
 job or scheduled task?  Thanks.
 
 Matt
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] scheduled tasks

2002-02-16 Thread flume33

Is currently anyway of doing scheduled tasks with PHP (without using 
crontab)? 
What's wrong with using cron?

I'm building an OSS  site where the PostgreSQL data base maintenance, 
email sending, stats gathering, number crunching and graph plotting 
needs to be automated. My target audience will need things as simple as 
possible. I am under the impression that it would be a hassle and cost 
more to get a web host to install a cron script for Postgres. (Or have 
php as an executable binary instead of shared object.)

What I do so far is look at a serial number from a data base table. If 
it is divisible by 20, I fill up a graph plotting que. If divisible by 
50, another que is filled, etc. The footer has a script that checks a 
table with each que status and then does does a few things out of the 
highest priority que.

I figure the user will not notice a few small scripts running after all 
the text is displayed. If there is a better way, let me know!!

Thanks, Jeff



Re: [PHP] scheduled tasks

2002-02-16 Thread Michael Sims

At 06:41 AM 2/16/2002 -0800, [EMAIL PROTECTED] wrote:
Is currently anyway of doing scheduled tasks with PHP (without using 
crontab)? 
What's wrong with using cron?

I'm building an OSS  site where the PostgreSQL data base maintenance, 
email sending, stats gathering, number crunching and graph plotting needs 
to be automated. My target audience will need things as simple as 
possible. I am under the impression that it would be a hassle and cost 
more to get a web host to install a cron script for Postgres. (Or have php 
as an executable binary instead of shared object.)

If the web host gives you access to a shell account then you could setup 
the script...you wouldn't need them to do it.  You could build a copy of 
PHP as an executable in your home directory and run it from there, no need 
to get the host to do it.

Or there are a few ways that you could schedule the task remotely...use a 
cron job from another server that either runs the PHP script locally, 
connecting to the SQL database remotely, or you can use a cron job and lynx 
to call a remote PHP page that will run your script.  Of course, this 
requires your script to be in your web servers directory tree, but if 
security is a concern you could always setup a .htaccess file to challenge 
for credentials then use the -auth switch to lynx in your remote 
script.  It's not the most secure thing in the world, but it's better than 
nothing...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] scheduled tasks

2002-02-16 Thread Erik Price


On Friday, February 15, 2002, at 03:03  PM, Rodney Davis wrote:

 Is currently anyway of doing scheduled tasks with PHP (without using
 crontab)?  For example, using an email script to send out e-mail
 reminders every Monday or something like that?

One way to do it (stole this from my 'Beginning PHP' book [Wrox]):

Store the current timestamp into a file.  Read this file every time some 
commonly-used feature of your site is executed.  Then, when X number of 
seconds has passed beyond the timestamp, execute some other code:

$countfile = ./countfile.txt;
$fp = fopen($countfile, 'r+');
$oldtime = fread($fp);

if ((time()) = ($oldtime + 24 * 60 * 60 * 7)) {
// a week has passed since the last time the file was written to
// execute the code (mail or whatever)
}

rewind($fp);
fwrite($fp, time());
fclose($fp);

or something like that.  NB this code is definitely untested, so it 
probably won't work, but the theory is there.  Also, be sure to take 
into account the security issues of having a file writeable by your web 
server -- I'm assuming you already have experience with this.

Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] scheduled tasks

2002-02-16 Thread B Richards

What do people think about making a cron job call a page by doing a lynx
http://www.site.com/automatedtasks.php every hour?


-Original Message-
From: Michael Sims [mailto:[EMAIL PROTECTED]]
Sent: February 16, 2002 9:59 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] scheduled tasks


At 06:41 AM 2/16/2002 -0800, [EMAIL PROTECTED] wrote:
Is currently anyway of doing scheduled tasks with PHP (without using
crontab)? 
What's wrong with using cron?

I'm building an OSS  site where the PostgreSQL data base maintenance,
email sending, stats gathering, number crunching and graph plotting needs
to be automated. My target audience will need things as simple as
possible. I am under the impression that it would be a hassle and cost
more to get a web host to install a cron script for Postgres. (Or have php
as an executable binary instead of shared object.)

If the web host gives you access to a shell account then you could setup
the script...you wouldn't need them to do it.  You could build a copy of
PHP as an executable in your home directory and run it from there, no need
to get the host to do it.

Or there are a few ways that you could schedule the task remotely...use a
cron job from another server that either runs the PHP script locally,
connecting to the SQL database remotely, or you can use a cron job and lynx
to call a remote PHP page that will run your script.  Of course, this
requires your script to be in your web servers directory tree, but if
security is a concern you could always setup a .htaccess file to challenge
for credentials then use the -auth switch to lynx in your remote
script.  It's not the most secure thing in the world, but it's better than
nothing...


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] scheduled tasks

2002-02-16 Thread B Richards


What do people think about making a cron job call a page by doing a lynx
http://www.site.com/automatedtasks.php every hour?


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: February 16, 2002 3:02 PM
To: Rodney Davis
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] scheduled tasks



On Friday, February 15, 2002, at 03:03  PM, Rodney Davis wrote:

 Is currently anyway of doing scheduled tasks with PHP (without using
 crontab)?  For example, using an email script to send out e-mail
 reminders every Monday or something like that?

One way to do it (stole this from my 'Beginning PHP' book [Wrox]):

Store the current timestamp into a file.  Read this file every time some 
commonly-used feature of your site is executed.  Then, when X number of 
seconds has passed beyond the timestamp, execute some other code:

$countfile = ./countfile.txt;
$fp = fopen($countfile, 'r+');
$oldtime = fread($fp);

if ((time()) = ($oldtime + 24 * 60 * 60 * 7)) {
// a week has passed since the last time the file was written to
// execute the code (mail or whatever)
}

rewind($fp);
fwrite($fp, time());
fclose($fp);

or something like that.  NB this code is definitely untested, so it 
probably won't work, but the theory is there.  Also, be sure to take 
into account the security issues of having a file writeable by your web 
server -- I'm assuming you already have experience with this.

Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] scheduled tasks

2002-02-15 Thread Michael Sims

At 10:03 AM 2/15/2002 -1000, Rodney Davis wrote:
Is currently anyway of doing scheduled tasks with PHP (without using
crontab)?  For example, using an email script to send out e-mail
reminders every Monday or something like that?

What's wrong with using cron?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php