Page 1 of 1

automatically timed script

Posted: Fri Jul 04, 2003 12:00 am
by cbcampbell
Is there any way to get a php script to set itself to run at regular intervals on a server?

The reason I'm asking is because I have a database. And I want the php script to run regularly (every millisecond if i could, but every 5 minutes would be fine) on the server. This is the update script. Here is the code:

Code: Select all

include("dbinfo.inc.php");

@mysql_connect(localhost,$username,$password) or die ("Could not connect to database\n");

@mysql_select_db($database) or die ("Database does not exist or could not connect\n");

$update = "UPDATE signups SET completed='Yes' WHERE paid='Yes' AND followup='Yes'";

mysql_close();
This is a "new customer" database I'm writing. So I can add a new customer I've signed up. And once I have received payment and followed up on them to make sure everything is running fine with the customer, I can return to the database and tell the database this and the update script should (the next time it runs) update the completed field automatically.

Posted: Fri Jul 04, 2003 2:19 am
by []InTeR[]
Cronjobs.. If you are working on a linux server.

But most of the paymet servers can give the payment information back trou a php script. Bitit does.

And then in that script i'm activating the account.

Posted: Fri Jul 04, 2003 11:17 pm
by cbcampbell
i'm sorry. i didn't quite understand all that.

Posted: Sat Jul 05, 2003 1:06 pm
by cactus
cron: Job Scheduler wrote:The crontab utility is mostly used to run (cron) jobs at the same time every day, every month, or every year. Every minute, the system checks a system file, called crontab, to see which (if any) processes/jobs need to be started.
Ref : http://www.sao.nrc.ca/imsb/rcsg/documen ... de173.html

Depandant on your access, you can create a cron job to run your script at a given time interval.

Two things, this can be done via Telnet/SSH access to your server or (if you have one) via a "control panel" supplied by your hosts.

Regards,

Posted: Sat Jul 05, 2003 3:33 pm
by cbcampbell
is there any possible way to implement that via phpmyadmin? I am not allowed to telnet to the server.

Posted: Sat Jul 05, 2003 3:49 pm
by cactus
Its not really something you can do through phpMyAdmin, basically you need to find away of connecting to your script so that it runs at a given time interval. Dependant on your platform and having a permanent net connection you should be able to find an application that will achieve this.

Eg : NNCron, Win32 version of cron:
http://www.webattack.com/get/nncron.shtml

Other than that I can't suggest anything else, sorry.

Regards,

Alternative to CRON

Posted: Sat Jul 05, 2003 4:15 pm
by itechnica
:D

Should you not have access to the web server, which appears to be the case here, place your php script on the webserver and from your system use task manager in window or cron in linux(unix) to visit that page every 5 minutes. Its a bit clunky but it works, it does require your system to be turned on 24/7 and modem with autodial or a xDSL/Cable connection.

What you really need is to get your hosting provider to setup a crontab for you. Many providers don't allow this, I know of some that do however.

All the best
itechnica