SpamAssassin (SA) is a program used for email spam filtering based on content matching rules. The Bayesian classifier that comes with SpamAssassin can be trained to recognize spam (or ham) based on a few sample emails. SA breaks the spam email into tokens or group of tokens for processing. Once SA is fed a large enough sample of spam tokens, it will start marking spam email with a higher score and thus block the spam. The same applies to ham except that the score is lower.
The sa-learn utility that comes with SA is the tool used to train SA on what is spam or what is ham. It is crucial to feed sa-learn with either spam or ham and not both at the same time. While sa-learn has several command line switches for various options, one only needs a couple of flags to have it process emails. The following two command lines are all one needs to get the job done:
To train SA on spam, run the following from the server in question:
sa-learn --showdots --mbox --spam spam-file
To train SA on ham, run the following from the server in question:
sa-learn --showdots --mbox --ham ham-file
spam-file and ham-file are files in Mailbox format. So what if your inbox is of type Maildir? There is an extra step involved in converting the Maildir format to a Mailbox. The utility mb2md can do the job seamlessly. Once the Maildir is converted to Mailbox, simply replace ‘spam-file’ in the command line above with the resulting Mailbox file from the conversion.
That’s all folks! We hope this was useful.
Depending on which version of Varnish you have running, there is a chance the code is still experimental and the whole Varnish daemon is prone to a fatal crash.
Here is a quick and dirty monitoring script for Varnish. It essentially runs as a crontab job and requests a PING response. Should it not receive a PONG from Varnish, it will attempt a restart. There is a second round of testing within the same script. This is a second level of PING request; just in case. Be sure to set the usual defaults like -T port and varnish runlevel script.
#!/bin/bash
result=$(echo -e "ping\n\r" | nc localhost 6082|grep PONG|wc -l);
if [ "${result}" -lt "1" ];
then
/etc/init.d/varnish stop;
sleep 5;
/etc/init.d/varnish start;
echo "$(hostname): Varnish restart" | mail -s "$(hostname): Restarting varnish" alerts@example.com;
fi
sleep 5;
results=$(echo -e "ping\n\r" | nc localhost 6082|grep PONG|wc -l);
if [ "${results}" -lt "1" ];
then
/etc/init.d/varnish stop;
sleep 5;
/etc/init.d/varnish start;
echo "$(hostname): Second Varnish restart" | mail -s "$(hostname): Restarting varnish second time" alerts@example.com;
fi
exit 0;
Finally load the job into crontab:
*/5 * * * * /root/varnish.sh
A cleaner way of accomplishing the same goal would be to establish a permanent connection to the Varnish admin port (6082 in this case) and issue a PING command every other second or so. The interval can be in the sub seconds as opposed to minutes as is the case with crontab.
Here is an example:
# telnet localhost 6082
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
ping
200 19
PONG 1274931430 1.0
ping
200 19
PONG 1274931434 1.0
ping
200 19
PONG 1274931437 1.0
ping
200 19
PONG 1274931443 1.0
We deploy Varnish and other tools on our clients’ server to get the most performance out of hardware. Our clients are happy with the performance boost and we are happy of the end result. Please do get in touch if you have any question or comment
That’s all folks!
Spamd is one the highest resource consumer on a cPanel server. It allocates a lot of memory from the get-go and holds on to it throughout. There is a way to limit the number of spamd processes that are spawned. On a cPanel server, which is what this guide covers, there is a configuration file called /etc/cpspamd.conf with the following lines:
maxspare=1
maxchildren=3
For a leaner server. we recommend dropping maxchildren to 1 and maxspare to 1. This will save a good hundred of megs of memory. Don’t forget to restart exim for these changes to take effect.
I hope this tip is useful. That’s all folks!
For those of you that cannot afford expensive dedicated servers. Checkout our new Bargain Bin Server lineup! Find a large variety of dedicated server for pennies on the dollar! Check it out here: http://www.unixy.net/bargainbin.html
Enjoy!
Howdy!
The above error can come up quite often on a busy database-driven website or it could happen at one time or the other for different reasons. Today, we are going to cover the main two reasons for it happening. I shall break this down by architecture.
The Out of memory error indicates that the whole system has run out of memory at that point in time. For example, I happened to be loading a customer’s database that required more than 4GB of free RAM on the system. The system had 2GB of free RAM to work with so the MySQL process failed to import the database due to a lack of memory. The solution here is to add more memory into the system.
Here, the error indicates that either the system ran out of memory, just like in x86_64 above, or that the process cannot address more memory even if it is available. This is more peculiar to the architecture than it is a shortcoming of MySQL. 32-bit operating systems are not capable of letting a process address more than roughly 4GB of memory. The best approach here is to install a 64-bit OS that is capable of addressing that much RAM.
Keep in mind that UNIXy fully manages its customers’ servers. Should this particular problem occur while assisting a customer, we are always more than happy to provide a complimentary memory upgrade to complete the task.
That’s all folks!
phpBB is a open source forum software. The board’s index page lists the topics along with a listing of online members. While trouble shooting a customer report of a slower loading of the board “index” page, we found out that the fix in itself is simple and easy to implement. We would like to share this solution in the hope that it will benefit others. It turns out one of the hot spot table, phpbb_users, is not indexed. The performance fix is to simply add an index on column user_email of only 15 characters. Here is an example of the index creation:
create index phpbb_users_email on phpbb_users (user_email(15));
That should do it. Enjoy the quick performance bump! Keep in mind that UNIXy is a fully managed shop and is always happy to lend a hand with systems questions. This is part of our fully managed services guarantee that comes with our VPS and dedicated servers.
That’s all folks!