Author Topic: Cron Job for Newday Runonce  (Read 14436 times)

Nightborn

  • Administrator
  • Sr. Member
  • *****
  • Posts: 320
  • Karma: +20/-0
    • View Profile
    • Shinobilegends
Re: Cron Job for Newday Runonce
« Reply #15 on: October 27, 2008, 05:47:10 pm »
do you have rights to execute the cron.php file?

check your file permissions.

oh, and if you think about making it 777 (world read/writeable) -> wrong idea.

by the way, if you try to access cron.php from a web browser (like here presumably) you get a 403 ...because I denied that in the .htaccess file =)
or your players will whack you with newdays ^^ as they can freely run the cron script.

go to the console, not a CPanel one, I mean a Linux root console.
The "linux shell" is a synonym for what I mean.

Else you can't test it  that way (I asked about you having a root server for a purpose)

rename the .htaccess file and then you can access it from your browser
BUT NAME IT BACK AFTERWARDS ^^


It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro

Alchemion

  • Guest
Re: Cron Job for Newday Runonce
« Reply #16 on: October 29, 2008, 03:25:16 pm »
I have allowed myself to test the cron.php from the host cpanel.

It works and tested fine.

I have one calendar day = one game day. I have set the cron to run at 22 GMT.

It appears nothing happens... there is no event written in the gamelog (in the grotto..)...

1. $gamedir from cron.php is the same with $gamedir from settings.php
2. the allow newday to run via cron job, from the game settings, is set to "yes"
3. the cron pointing to cron.php is set from the host cpanel and tested OK

.... why the cron does not work, as it gives no registered event in the gamelog... where else should I look to make sure the cron is set ?... and after set, where else should I look to see any activity produced by this cron....

Thank you very much for your help.

Nightborn

  • Administrator
  • Sr. Member
  • *****
  • Posts: 320
  • Karma: +20/-0
    • View Profile
    • Shinobilegends
Re: Cron Job for Newday Runonce
« Reply #17 on: October 29, 2008, 03:44:42 pm »
if you run cron.php and it works (gamelog entries generated) then the problem is with the CPanel not running the job (reasons unknown)

as said, if CPanel just calls the job from WITHOUT the shell, then you have a world-open chance for your players to let them do their own server-wide newdays... :-/

Activity by cron -> gamelog entries
that's how you check

Quote
2. the allow newday to run via cron job, from the game settings, is set to "yes"
that only tells lotgd NOT to run any server-wide newdays ;)

if the execution via browser (remember? I told you to rename/remove .htaccess and then try from your browser) fails, I can't help you further.
If it works, and only the CPanel job does not work, contact your hoster.
It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro

Alchemion

  • Guest
Re: Cron Job for Newday Runonce
« Reply #18 on: October 29, 2008, 04:18:19 pm »
Thank you for quick replies...

As told, I have allowes myseld to run cron.php from browser and even the tested cron from cpanel gave the "ok" result.

...yet, even from browser (whree from I don't get a 403 page) and even from cpanel (where the cron tested ok) the cron seem to not doing any activity within the game...

I have the 1.2.0 +nb source files... should I reget some files and overwrite some old ones ?...

Quote
that only tells lotgd NOT to run any server-wide newdays

If I set this to "NO",  the newday runonce  would no longer trigger on cronjob, but only to the first player playing the game in that new game day ?... do all players have to wait the bunch of newday jobbing time ?...

Edit: I had to rename the gamedir inside more lib files... I have seen some event registered into the gamelog... though I have tried again the cronjob, it appears only once a day it is doable... I shall test it more tonight, when expecting to do its trick at 0.0 a.m. ...  :)

I think it works... at least, I hope it does... :)
« Last Edit: October 29, 2008, 05:39:39 pm by Alchemion »

Nightborn

  • Administrator
  • Sr. Member
  • *****
  • Posts: 320
  • Karma: +20/-0
    • View Profile
    • Shinobilegends
Re: Cron Job for Newday Runonce
« Reply #19 on: October 29, 2008, 10:28:30 pm »
Quote
If I set this to "NO",  the newday runonce  would no longer trigger on cronjob, but only to the first player playing the game in that new game day ?... do all players have to wait the bunch of newday jobbing time ?...

yes.
cronjob has 1 advantage: there is no player "hitting" it... the server hits it automatically. Hence it always runs on specific times, people logged in or not.
And it is not 1 player stuck until it's done - but all are slower (very, depends on the load).

0 am does not do the trick ;)
if you like, add to cron.php a gamelog entry that the cron worked or not.

Code: [Select]
14 if ($game_dir!='') {
 15         savesetting("newdaySemaphore",gmdate("Y-m-d H:i:s"));
 16         require("lib/newday/newday_runonce.php");
 17 }
change to
Code: [Select]
require_once("lib/gamelog.php");
if ($game_dir!='') {
        savesetting("newdaySemaphore",gmdate("Y-m-d H:i:s"));
        require("lib/newday/newday_runonce.php");
       
        gamelog("Cronjob was tried to execute");
} else {
        gamelog("Cronjob could not be run - empty game dir");
}
and

Code: [Select]
10         if ($email=='') exit(0); //well, we can't go further
to
Code: [Select]
if ($email=='') {
                        require_once("lib/gamelog.php");
                        gamelow("Cronjob failed but no email to report given");
                         exit(0); //well, we can't go further
}
It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro

Alchemion

  • Guest
Re: Cron Job for Newday Runonce
« Reply #20 on: November 04, 2008, 02:01:26 pm »
My dear pal,

These days I've been quite busy with the aquirement of a new car... papers, authorities and so forth... very happy with my new car... :D

I can not tell the same with my nb core test server... i don't know why but, while trying to test the sugested modifications to cron.php file, after uploading new 1.2.1 files over my latest 1.2.0 files, I got an error of the templates...
Quote
You have one or more errors in your template page!
.. it sends me to the installer, but this one too has templates errors... I gave up, for the time being...

Hope these days I will chill out and get over the nasty errors...

otherwise, all the best!



Nightborn

  • Administrator
  • Sr. Member
  • *****
  • Posts: 320
  • Karma: +20/-0
    • View Profile
    • Shinobilegends
Re: Cron Job for Newday Runonce
« Reply #21 on: November 04, 2008, 02:54:25 pm »
Hi,

I've been sick in bed, so we all had a good time...
 ;)

Re-upload the entire files - that should fix it. the cron has nothing to do with the templates so I don't think there is an error.

I also did nothing to the pageparts and that version is running on my servers now - so it should work.

It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro

Alchemion

  • Guest
Re: Cron Job for Newday Runonce
« Reply #22 on: November 06, 2008, 07:42:42 am »
Hi,

I have re-uploaded all files and again got same template error... i have deleted all cache... the same... strange... I had to choose another template than the one default, to have the game viewable...

This cron job costed me the erasure of all previous tested settings ...nasty job to retake all at hand re-testing... not quite all...

I have an inquiry for you that would better go on private... it is about some private and not publically realeased modules... I have some ideas and I "heard" that you already implemented and tested it... being your rightfull code property, it is obvious that these not publically realeased modules cannot be demanded without a fair bargain for your work... :)

PM or IM: spiritofword@yahoo.com

I am interested in the pvp arena battle system and the equipment system... Thank you.
« Last Edit: November 06, 2008, 08:32:41 am by Alchemion »

Nightborn

  • Administrator
  • Sr. Member
  • *****
  • Posts: 320
  • Karma: +20/-0
    • View Profile
    • Shinobilegends
Re: Cron Job for Newday Runonce
« Reply #23 on: November 06, 2008, 12:47:55 pm »
Hi,

ah, now I know -> you talk about the "modern" template.
Yes, that's currently in progress - your switch was right.

Sorry, I think we had a misunderstanding.

@my modules

I have no pvp arena system Oo
I have a modified version of lonnys battlearena, which is public for download at lotgd-downloads.com
The equipment system is from XChrisX, I modified it to get it to work and therefore it's also public, I'll upload it to lotgd-downloads.com

if you want to debate private stuff, use forum PNs =)
It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro