Jump to content
MakeWebGames

Major Problems - Please Help!


Mark F
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...