1bigbear Posted January 19, 2010 Share Posted January 19, 2010 I have to build a script that will perform a certain actions at specified intervals, and I don't know how to do it. I have a list of events something like her: walk every 30 minutes run every 10 minutes talk once a day sit once a week I have four actions that need to be performed at different intervals, I have in a database the time when the task was last performed, the interval, and the future time when the action must be performed. Because I can't use cron I am thinking of using a page that reloads every 1 minute as the clock to compare the actual time with the all tasks future time, if they are equal or future time is lower that the actual time then perform the task. What do you think is this a good method or there are more simple ways of doing this? Quote Link to comment https://forums.phpfreaks.com/topic/189091-scheduled-actions-using-page-reload/ Share on other sites More sharing options...
p2grace Posted January 20, 2010 Share Posted January 20, 2010 Unless you're required to use a database, I wouldn't necessarily recommend it. This whole thing could be done through javascript and setInterval(). You wouldn't ever need to refresh if you only used javascript. Quote Link to comment https://forums.phpfreaks.com/topic/189091-scheduled-actions-using-page-reload/#findComment-998364 Share on other sites More sharing options...
1bigbear Posted January 20, 2010 Author Share Posted January 20, 2010 I need to use a database, and I haven't found a better way Quote Link to comment https://forums.phpfreaks.com/topic/189091-scheduled-actions-using-page-reload/#findComment-998965 Share on other sites More sharing options...
greatstar00 Posted January 20, 2010 Share Posted January 20, 2010 if u are doing 1 by 1 like all those actions a user perform, and wont affect others, then just use javascript, with ajax, or meta reload if one master user perform t hose action, and affect all others, and if u are using virtual server, or delicate server (anything that u have access to system root), u can set up a page for your self only, have that virtual server refresh it once a while using http://localhost/action.php?act=somethingsomething in this action page, u have <meta refresh=86400 /> <!--86400=seconds in a day--> if u dont have access to system root, and dont want to do this dont want to do this -->>when a user request, it update all stuff according to time, and calculation then u must do this, ask all your administrators, and your self, to load your page in that amount of time, with meta tag (u dont need to do it by your self, just open the browser, let it refresh automatically dotn worry, if u have alot of admin to do it, just check whether it is time to do so, and 1 of them will do it, others just display error message, with meta tag there also Quote Link to comment https://forums.phpfreaks.com/topic/189091-scheduled-actions-using-page-reload/#findComment-998986 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.