View Full Version : Trigger events without Crontab
01-23-2007, 04:21 PM
Hi, I am trying to create a turn-based Web-based MMO. The hosting I currently have does not allow for the use of a Crontab, and so my question is:
Is there any way to trigger events hourly, daily, monthly etc. without a Crontab?
More specifically, is there any way to trigger the next turn after a period of time without the use of a crontab?
01-23-2007, 05:00 PM
You could just create a page to do it and have a <meta> tag refresh the page after a certain amount of seconds, though it will mean you must have your computer on constantly.
Another way you could do it is to store time() in a database for each user and calculate the points as they come on, e.g.:
$time = ''; // get time for database
$now = time();
$spp = 60; // seconds per point
$points = ($now - $time) / $spp;
01-23-2007, 10:00 PM
Well what I need it to do, is trigger a script to update all users at once, and add turns, finish tasks, begin tasks, etc.
Also, I will need a longer term one, say two weeks to clear things and reset a map and certain locations.
01-23-2007, 10:44 PM
You could do it like vBulletin, have a cron.php script which checks if an event has passed (record the time last executed, etc.) and execute when someone loads a page and it's past or at time.. If something needs to be executed, execute it. Perhaps use exec() to background a php process or similar which runs another script.
01-24-2007, 05:45 PM
The problem with that is I need this to happen on its own after a certain amount of time.
01-24-2007, 06:19 PM
I think without Crontab your only hope is to use tricks like the one vBulletin mentions.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.