From sailing the high seas as part of a Pirate Crew to living the life of an Outlaw in the Old West, this year is shaping up to be another great one for games.
Our 10 Most Anticipated Games for 2018
The epic trilogy concludes. Part Three in our journey to build a new gaming rig, with all the graphs and numbers you can handle.
Benchmarking Our New Gaming PC
Turning iconic Blizzard heroes into anime inspired robots isn't as easy as it sounds.
Blizzard Interview - Talking Heroes of the Storm Mecha Skins
Where we took at look in our hardware room and noticed both a Cooler Master MasterLiquid Pro 240 Closed Loop Watercooler and Geforce GTX 1070 Founders Edition just sitting there.
Hardware Mod - Liquid Cooling + Geforce GTX 1070
What am I doing wrong?
arkter
Gold Coast, Queensland
642 posts
Cron jobs... whats wrong with this.. I'll be f***ed if I can figure out what I've done wrong...


# Delete expired files
if($c->{files_expire_access_anon} || $c->{files_expire_access_reg} || $c->{files_expire_access_prem})
{
for my $srv (@$servers)
{
my @files;
if($c->{files_expire_access_anon})
{
my $list = $db->SelectARef("SELECT f.*
FROM Files f
WHERE srv_id=?
AND f.usr_id=0
AND file_last_download < NOW()-INTERVAL ? DAY",
$srv->{srv_id},$c->{files_expire_access_anon});
push @files, @$list;
}
if($c->{files_expire_access_reg})
{
my $list = $db->SelectARef("SELECT f.*
FROM Files f, Users u
WHERE srv_id=?
AND f.usr_id=u.usr_id
AND usr_premium_expire AND file_last_download < NOW()-INTERVAL ? DAY",
$srv->{srv_id},$c->{files_expire_access_reg});
push @files, @$list;
}
if($c->{files_expire_access_prem})
{
my $list = $db->SelectARef("SELECT f.*
FROM Files f, Users u
WHERE srv_id=?
AND f.usr_id=u.usr_id
AND (usr_premium_expire IS NULL OR usr_premium_expire < NOW())
if $c->{dont_expire_premium};
AND (usr_premium_expire IS NULL OR usr_premium_expire < DATE_ADD(NOW(), INTERVAL -30 DAY) )
if $c->{dont_expire_premium};
push @files, @$list;
}


next if $#files==-1;
print"Have ".($#files+1)." files to delete from SRV=$srv->{srv_id}...\n";
$ses->DeleteFilesMass(\@files);
print"Done.
\n";
}
}



specifically:


{
my $list = $db->SelectARef("SELECT f.*
FROM Files f, Users u
WHERE srv_id=?
AND f.usr_id=u.usr_id
AND (usr_premium_expire IS NULL OR usr_premium_expire < NOW())
if $c->{dont_expire_premium};
AND (usr_premium_expire IS NULL OR usr_premium_expire < DATE_ADD(NOW(), INTERVAL -30 DAY) )
if $c->{dont_expire_premium};
push @files, @$list;

07:51pm 22/02/12 Permalink
system
Internet
--
07:51pm 22/02/12 Permalink
Nerfy
Brisbane, Queensland
5405 posts
I hear ya, but eventually you've just gotta stop asking, and accept that this is the way that you will have to live your life.

(soz, what I really meant was, maybe try stackoverflow, since I don't know what cronjobs are I suspect that it might be a niche help topic.. edit: whoa, people do know things about cron jobs!)
07:55pm 22/02/12 Permalink
Hemerage
Brisbane, Queensland
15461 posts
You forgot a comma.
08:01pm 22/02/12 Permalink
Captain Lateral
Brisbane, Queensland
4422 posts
gotta stack trace or a better description of what you're trying to achieve and what its not doing?

EDIT:
also,

push @files, @$list;
is missing a ")" at the end?

last edited by Captain Lateral at 20:04:49 22/Feb/12

last edited by Captain Lateral at 20:08:34 22/Feb/12
08:02pm 22/02/12 Permalink
teq
Brisbane, Queensland
12623 posts
SELECT f.* FROM Files f, Users u WHERE srv_id=? AND f.usr_id=u.usr_id AND (usr_premium_expire IS NULL OR usr_premium_expire < NOW())

what does that query return if you run it on the command line (presumably postgres?)
obviously replace ? with a correct srv_id

it doesn't look like you're selecting any columns from Users because you've only specified f.* and nothing for Users
08:11pm 22/02/12 Permalink
Dazhel
Gold Coast, Queensland
4459 posts
What am I doing wrong?

Using Perl.

Smart arse comments aside, it looks like you haven't terminated the string constant for the database query.
The other queries have a " at the end of the query where the rest of the code continues.

The method call to $db->SelectARef("SELECT f.* blah blah blah", x, y, z); looks to be a parameterized query, where you'd need to specify x, y, and z variables that get replaced in the query at the places marked by the question marks.
08:33pm 22/02/12 Permalink
arkter
Gold Coast, Queensland
643 posts
thanks for pointers... I'm f*****g s*** at perl and really just trying my best here....



it doesn't look like you're selecting any columns from Users because you've only specified f.* and nothing for Users


Not the problem, much love for help though

Smart arse comments aside, it looks like you haven't terminated the string constant for the database query.
The other queries have a " at the end of the query where the rest of the code continues.


Will punch myself in the face if this fixes it... will get back to you... ty again
08:55pm 22/02/12 Permalink
trillion
Brisbane, Queensland
2614 posts
for future reference you could probably have resolved this yourself if you made use of a coloured syntax highlighting text editor like emacs, vi, or notepad++ in windows
09:50pm 22/02/12 Permalink
system
Internet
--
09:50pm 22/02/12 Permalink
AusGamers Forums
Show: per page
1
This thread is archived and cannot be replied to.