Recent Topics

CPanel cron to grab b2evo antispam updates

Started by on Feb 28, 2005 – Contents updated: Feb 28, 2005

Feb 28, 2005 00:57    

Can someone provide a few pointers on setting up cron via CPanel's interface, so that b2evo's antispam blacklist is updated automatically?

I installed b2evo via fantastico at my hosting provider. I noticed that when I updated the antispam list manually the first time, it didn't retrieve the entire list of updates, but only the first set (July 2004, I believe). I had to manually run the update via b2evo's admin interface about 10 times or so, to get all the updates up to the most recent. Is this normal?

Thanks for any suggestions re the cron setup.

jj.

Feb 28, 2005 01:16

jibberjab wrote:

Can someone provide a few pointers on setting up cron via CPanel's interface, so that b2evo's antispam blacklist is updated automatically?

I installed b2evo via fantastico at my hosting provider. I noticed that when I updated the antispam list manually the first time, it didn't retrieve the entire list of updates, but only the first set (July 2004, I believe). I had to manually run the update via b2evo's admin interface about 10 times or so, to get all the updates up to the most recent. Is this normal?

Thanks for any suggestions re the cron setup.

jj.

ermm. thats a loaded question since you didnt really indicate if you understood how to set up cron jobs in cpanel generally.
so ...

first, rather than explain how cpanel's cron set up thing works.. youn can read this: http://www.webmasterstop.com/dev/102.html which gives a general overview of cpanel's cron interface.

as for setting up a specific cron to update the blacklist..

once you understand the top part of this reply, it *could* be as simple as setting up a simple wget that goes out and fetches the page. wget allows you to to specifiy a login and password if you are accessing a page requiring one, as you will.

Like so ...

wget username:password@http://www.yourdomain.com/b2evo/admin/b2antispam.php?action=poll

I said *could* up above because many hosts have disabled wget due to security issues.

Feb 28, 2005 08:37

jibberjab wrote:

I noticed that when I updated the antispam list manually the first time, it didn't retrieve the entire list of updates, but only the first set (July 2004, I believe). I had to manually run the update via b2evo's admin interface about 10 times or so, to get all the updates up to the most recent. Is this normal?

Yes that is the normal behavior (I don't say that is should be normal)
The first time is the most intensive.
Every time you update the blacklist,you have to make shure that you you click on 'update the blacklist" at least that many times till it shows the correct date (now)

Mar 01, 2005 02:34

Thanks for the assistance. I'm still kind of looking at the cron procedure. Not sure I'm able to do wgets on my hosting account. Don't have shell access.

Sorry, i didn't think it was a loaded question, but perhaps I should have just said I'm a newbie with all of this. So far just feeling my way around in the dark, so to speak.

jj.

Mar 01, 2005 02:53

you dont need shell access to find out if wget is available -- thats the idea behind cpanel's access.

Once you have set up the cron job you will get an email, if, for some reason wget is disabled trust me, the e-mail will tell you.

If your still contemplating setting that up, the standard (non advanced) button in cpanel's cronjob setup area should be newbie-friendly enough for you.

Mar 02, 2005 06:37

Hey guys,

This is something that i'd been meaning to do for some time as well since it was really annoying me that i had to manually update this kind of thing. So this question spurned me into actually doing something about it.

Anyways, this may not be the best way to do things, and if there is a better way i would welcome theinput, but i thought i would share what i did.

I found that the default files will not let a person actually use wget to get the website. they just send the user to the login screen since by default it seems to be neccessary to be logged in to get antispam updates (which makes sense to a degree).

So what i did was create a file that i dropped in my admin directory called updateantispam.php

here is what i put in it.

<?php

require_once( dirname(__FILE__) . '/../conf/_config.php' );
require_once( dirname(__FILE__) . "/$admin_dirout/$core_subdir/_main.php" );
require_once (dirname(__FILE__).'/'.$admin_dirout.'/'.$core_subdir.'/_functions_antispam.php');

b2evonet_poll_abuse( );

?>

This just includes the required info to actually access the database and then calls the antispam update function. I set up a cron job to call this using wget and i think it's working ( i tested it from the browser and it seems to do the job ).

Anyways. Hope this is useful.

Brent.

Mar 02, 2005 07:48

yeah thats why i included the login/passwd in the command .. my suggestion may or may not work, I havent tested it specifically.

whatever works is good for all, I reckon :)

brent, you might want to update your phpBB install... just a headsup

Mar 02, 2005 18:00

Thanks for the heads up about the phpbb2. It's now upgraded :)

Ya i thinking the username and pass is only for sites that require authentication that has been restricted through .htaccess type things. The kind that actually pops up a prompt for a username and password.

Mar 02, 2005 18:08

well, that I dont know.
I am using a windows binary of GNU wget to grab my accesslogs off of cpanel.. the running logs that turn into the backed-up daily logs.. I have fixed up my wgetrc just as I would were it on a NIX box, set the username and passwd, since I only use it for this one thing, and it works flawlessly. cpanels login screen is not htaccess driven.

Mar 02, 2005 18:53

ya ok... that may be true ... i dont' use cpanel (i'm using webmin to administer my linuxbox through the web) so there are likely differences. I am by no means an expert in the subject :)

Apr 09, 2005 19:04

btokarchuk's script worked for me. Thanks.

whoo's returned "Unsupported scheme" on my host.

Apr 10, 2005 04:04

That works, but the files it downloads contain the whole antispam list, and weigh in at over 2 MB. The other way creates only a tiny file. I know I could create another cron job that deletes the big files after a while, but I'll probably end up leaving the small ones there until I look them over.

Apr 11, 2005 20:37

I wrote another script that reads the file updateantispam.php downloaded by wget and puts the contents into an email. Then I wrote a shell script that wgets the update script, then wgets my script, which emails the results of the update to me and then two lines at the end of the shell script remove the two files that I downloaded. It's not exactly elegant and I'm sure it could have all been done in one php script if I knew what I was doing, but this should work for me. I set the cronjob to run every two days, so I should get an email every two days with the output of the antispam update. I'm sure there are better ways to do this, but if anyone is interested I'd be glad to share how to do it this way.

Apr 12, 2005 16:22

hmm that would be sweet I may try that on my site

Apr 19, 2005 23:04

personman wrote:

I wrote another script that reads the file updateantispam.php downloaded by wget and puts the contents into an email. Then I wrote a shell script that wgets the update script, then wgets my script, which emails the results of the update to me and then two lines at the end of the shell script remove the two files that I downloaded. It's not exactly elegant and I'm sure it could have all been done in one php script if I knew what I was doing, but this should work for me. I set the cronjob to run every two days, so I should get an email every two days with the output of the antispam update. I'm sure there are better ways to do this, but if anyone is interested I'd be glad to share how to do it this way.

I would be interested to know how you did that if you still care to share. :)

Apr 19, 2005 23:40

I have a cronjob set up like this:

15 2 * * * /home/brendom/public_html/b2e/cronupdates/updateantispam.sh

which runs this shell script once a day

/b2e/cronupdate/updateantispan.sh

cd /home/brendom/public_html/b2e/cronupdates/;
wget http://70.84.193.50/~brendom/b2e/admin/updateantispam.php;
wget http://70.84.193.50/~brendom/b2e/cronupdates/mail/mailupdate.php;
rm updateantispam.php;
rm mailupdate.php;

which wgets this file, doing the update and saving the report as a file.

/b2e/admin/updateantispam.php

<?php

require_once( dirname(__FILE__) . '/../conf/_config.php' );
require_once( dirname(__FILE__) . "/$admin_dirout/$core_subdir/_main.php" );
require_once( dirname(__FILE__) . "/$admin_dirout/$core_subdir/_functions_antispam.php" );

b2evonet_poll_abuse( );
?>

Then the shell script wgets this file, which mails the report to my email address:

/b2e/cronupdate/mail/mailupdate.php

<?php
$filename = "/home/brendom/public_html/b2e/cronupdates/updateantispam.php";
$handle = fopen($filename, "r");
$message = fread($handle, filesize($filename));
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail('personman2@gmail.com', 'Antispam Update', $message, $headers);?>

Finally, the shell script deletes the two files that wget created.

In my gmail in box I set up a filter that automatically archives these messages and assigns them the label "B2e Antispam". So they don't clutter up my inbox, but I can just click on that label heading and see all of the update reports.

I'm sure this set up can be improved upon, so feel free to give me some ideas.

Jun 22, 2005 05:26

Now I am a bit confused. Where is updateantispam.php supposed to be. in one bit of the code you have it in the admin folder and in the other bit you have it in cronupdates?

Is it supposed to be in both then?

wget admin/updateantispam.php;

$filename = "cronupdates/updateantispam.php";

Update: Can't seem to use this anyway:
updateantispam.sh: Permission denied

That was emailed to me after the cronjob ran.

Jun 22, 2005 06:27

You're right. I actually have it in both places, but it would be better to just have one copy of the file and fix the code so it points to that.

Jun 28, 2005 02:24

isaac wrote:

You're welcome.

Also check out http://isaacschlueter.com/blog/automatic_antispam_recheck_cron

I get this error:

Unknown column 'aspm_checked' in 'where clause'(Errno=1054)

Your query:
SELECT aspm_ID, aspm_string, aspm_source FROM `evo_antispam` WHERE aspm_checked = 'no'

I checked the database and that column isn't there..?

Update: Thanks. I checked that link:
http://wonderwinds.com/hackblog.php/2005/02/07/antispam_recheck_tool_part3

and it helped me fix the error. It is going to be a pain to put it on all my b2evo domains but will be well worth it. Thanks again for all your help. I can't tell you how much it is appreciated. :D

Heidi


Form is loading...

Photo albums software – This forum is powered by b2evolution CMS, a complete engine for your website.