interpim Posted March 16, 2007 Share Posted March 16, 2007 Well, what I want to do is, run a script once every say, 30 minutes... basically run through a script and process every row in my database. Well... I figured a Cron Job was the easiest way to go about this... but my host doesn't support it at the moment. Is there any other way to get a script to run automattically without user intervention on a set time schedule? Link to comment https://forums.phpfreaks.com/topic/42932-host-doesnt-support-cron-jobs-what-to-do/ Share on other sites More sharing options...
btherl Posted March 16, 2007 Share Posted March 16, 2007 If your site is accessed regularly, you can have some code that runs every time your site is accessed. This code will check when your job was run last, and run it again if it was run more than 30 minutes ago. That will give you an "at least 30 minutes" job. Alternatively, you can run the cron job somewhere else and have it hit a script on your site every 30 minutes. That script can do the work. Link to comment https://forums.phpfreaks.com/topic/42932-host-doesnt-support-cron-jobs-what-to-do/#findComment-208535 Share on other sites More sharing options...
realjumper Posted March 16, 2007 Share Posted March 16, 2007 What about using php's date funtion..... $time = date("i"); if ($time == '15') { // execute script at quater past the hour } elseif ($time == '45') { // execute script at quater to the hour } Link to comment https://forums.phpfreaks.com/topic/42932-host-doesnt-support-cron-jobs-what-to-do/#findComment-208536 Share on other sites More sharing options...
realjumper Posted March 16, 2007 Share Posted March 16, 2007 Onb second thoughts the above probably won't work...sorry....fingers in gear before brain!! Link to comment https://forums.phpfreaks.com/topic/42932-host-doesnt-support-cron-jobs-what-to-do/#findComment-208537 Share on other sites More sharing options...
interpim Posted March 16, 2007 Author Share Posted March 16, 2007 well... what I am doing is making a little game in php... basically I want to give all the users x number of turns every x number of minutes... The site isn't really accessed often enough to rely on someone to log in to call the script... so I am not sure what will work that will give everyone a fair amount of turns. I was thinking of taking a timestamp everytime a user used a turn, then next time he loads a page i would call a function that would check current time against his last turn time and increment it 1 time for every x amount of units went by since that timestamp... but that limits me to setting it off of their time they used the turn... not every 15 minutes which is what I would like to do. Link to comment https://forums.phpfreaks.com/topic/42932-host-doesnt-support-cron-jobs-what-to-do/#findComment-208544 Share on other sites More sharing options...
interpim Posted March 16, 2007 Author Share Posted March 16, 2007 well... I think i found a solution, If anyone is interested ask and I will update with how it goes... otherwise this is what I am now going to try... http://www.remote-cron.com/index.php Link to comment https://forums.phpfreaks.com/topic/42932-host-doesnt-support-cron-jobs-what-to-do/#findComment-208550 Share on other sites More sharing options...
interpim Posted March 16, 2007 Author Share Posted March 16, 2007 Well... remote-cron.com wasn't working evidently, so I found another, and It does work but restricts you to only once an hour. here is that site address if anyone is interested... http://www.webcron.org/ Link to comment https://forums.phpfreaks.com/topic/42932-host-doesnt-support-cron-jobs-what-to-do/#findComment-208604 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.