View Full Version : Corn Problem, please help
ok i made a script the delete info from some table,
now i added it to corn in admin cp to run every 1st of month
its apper like that
30 0 1 * *
now the problem is that its never run :(
when i click on run now its works like a charm
but its dosent work alone
also in next time it says :
02-28-2005 11:30 PM
but date now is 06/03 and script didnt runned yet
any idea what might be the problem
thanks MiZ
bump
please help... not supuse to be that hard
Marco van Herwaarden
03-09-2005, 03:59 PM
Try posting the script. The scheduled tasks can be a bit tricky sometimes, had to learn that the hard way myself. Sometimes things run ok with Run Now, but fail when run scheduled.
ok
here is the info of the file
scoreboardupdate.php
=================
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($DB_site))
{
exit;
}
// Score board , Award system , Ratio system
// looking for a winner
$scorewinner =$DB_site->query("SELECT * FROM ".TABLE_PREFIX."user order by tmsecs Desc limit 1");
while ($scorewins = $DB_site->fetch_array($scorewinner)) {
$totaltmsecs = $scorewins['tmsecs'];
$winnername = $scorewins['username'];
$winnerid = $scorewins['userid'];
$lastmonth = $scorewins['tmsecs'];;
}
// clear last month modes
$DB_site->query("UPDATE ".TABLE_PREFIX."useraward SET award1 = '0'");
// set new award winner
$DB_site->query("UPDATE ".TABLE_PREFIX."useraward SET award1 = '1' where userid='$winnerid'");
// upadte user ratio
$DB_site->query("UPDATE ".TABLE_PREFIX."user SET credit =credit+50 where userid='$winnerid' ");
// update winner last month secs
$DB_site->query("UPDATE ".TABLE_PREFIX."user SET lmsecs ='$lastmonth' where userid='$winnerid'");
// clear all tmsecs of users
$DB_site->query("UPDATE ".TABLE_PREFIX."user SET tmsecs = 0");
$DB_site->query("TRUNCATE TABLE ".TABLE_PREFIX."`scoreboard`");
log_cron_action('Scoreboard Updated', $nextitem);
Marco van Herwaarden
03-09-2005, 05:38 PM
I don't see a good reason why it should not run in cron. Did you check if you maybe got a SQL-error mail?
A few remarks though:
- The table useraward, does it contain all users? If not the new winner might fail if it is the first time someone wins.
- No need to use quotes around numeric values in queries, only cast the value to an INT if it is a dirty value (user inputed).
- Not sure if that truncate statement will work correct when a table prefix is used, because of the back-tics.
- Does the run get logged in the cron-log?
when i run the script with run now button its work perfect
and when i click on run now its get logged
but else its just not working.
script working great as script
but on corn its not get executed
Marco van Herwaarden
03-10-2005, 05:30 PM
Well if it gets logged, then it is executed without a SQL-error.
Will try to look at it tomorrow (hmm why this sentence sounds familiar, hmmm think i forgot to do some things i promosed to do today :( )
What about the table being populated with all userids before the script is run?
Marco van Herwaarden
03-10-2005, 05:55 PM
Does the useraward table already have an entry for every existing userid in it?
// set new award winner
$DB_site->query("UPDATE ".TABLE_PREFIX."useraward SET award1 = '1' where userid='$winnerid'");
You only do an update for the new winner, but what if this user never win before? Will there already be an (empty?) entry in the table?
well then it shows as
USERID : 54
AWARD1 : 0
same for all users
Marco van Herwaarden
03-11-2005, 03:39 PM
sorry don't really understand your reply
You only do an update for the new winner, but what if this user neverwin before? Will there already be an (empty?) entry in the table?
if there isnt a winner so under award1 you got 0
so in the useraward table you got all userid's that on board
and under award1 you got 0
so for exsample
userid : 5
award1 : 0
userid : 6
award1 : 0
0 means user dont have the award
if you will change 0 to 1
its means that user that have 1 got the award
and thats what
// set new award winner
$DB_site->query("UPDATE ".TABLE_PREFIX."useraward SET award1 = '1' where userid='$winnerid'");
is doing its set new award winner by set award1 to 1 so he will be a winner
got it >
so the problem is for sure not on this line
Marco van Herwaarden
03-11-2005, 04:03 PM
Ok, so that answers my question: Yes all userids are already in that table.
filburt1
03-11-2005, 04:37 PM
when i run the script with run now button its work perfect
and when i click on run now its get logged
but else its just not working.
script working great as script
but on corn its not get executed
Cron. Not corn.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.