Mark F Posted June 11, 2008 Posted June 11, 2008 Hello Everyone, I recently moved my game across servers, though I have been having problems, most likely with my crons. Features like Energy, Brave and Will etc have all stopped working. I have entered my crons into Cpanel, and checked that the code matches that in config.php I would appreciate it if I could have some help! Does anyone know a simple cron test that I could run? Quote
Spudinski Posted June 11, 2008 Posted June 11, 2008 Re: Major Problems - Please Help! Try this as a sample: <?php $interval = (5 * 60); // run every 5 minutes if (!file_exists('cron_test.txt')) { $fp = fopen('cron_test.txt', 'w'); if (flock($fp, LOCK_EX)) { fwrite($fp, time()); flock($fp, LOCK_UN); } else { exit; } } else { $time = time(); // cache it $data = file_get_contents('cron_test.txt'); $sum = ($time - $data); if ($data == 'SUCCESS' || $data == 'FAIL') { exit; } elseif ($sum >= $interval) { $status = 'FAIL'; } else { $status = 'SUCCESS'; } $fp = fopen('cron_test.txt', 'w'); if (flock($fp, LOCK_EX)) { fwrite($fp, $status); flock($fp, LOCK_UN); } else { exit; } } ?> Createa file called "cron_test.txt" in the same directory as this file, and set its permissions to 777. Also setup a cron to execute this file every five minutes, and then after about a hour, check the contents of the file. If it is empty, contact your host and tell then that the crontabs are not working, if it says "FAIL" or gives a few numbers, the system time might be incorrect, or the crontabs are faulty. But if it says "SUCCESS", everything seems to be working. Quote
Mark F Posted June 11, 2008 Author Posted June 11, 2008 Re: Major Problems - Please Help! Thanks for that, I will try it out! Quote
juelpatwary Posted June 11, 2008 Posted June 11, 2008 Re: Major Problems - Please Help! I probably know whats wrong. Do you know when you setup the game first and it gave you a code at the end of the crons? Its in config i think, Its like this "4570246527246542" And its in the crons when you input them, Im sure its something with that. I wouldnt know how to fix though, Quote
POG1 Posted June 12, 2008 Posted June 12, 2008 Re: Major Problems - Please Help! go to confix.php and get the long code and u need that for the cron 2 work.. Quote
Mark F Posted June 12, 2008 Author Posted June 12, 2008 Re: Major Problems - Please Help! Thank you for your help, though I had already checked that out. I think that the problem must be on my hosters end, because when I run the file manually it seems to work. Quote
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.