Installing Viber 32 bit on Linux, under wine.

I've seen a few posts about doing this, which should be a relatively simple matter. Install wine, download the Viber installer, and then run 'wine ViberSetup.exe' from a command prompt. And it should be that simple. Except it wasn't in my case, and none of the guides acknowledged any issues. So here, for the internet … Read more

WordPress Multi Site (WPMU) close all old posts script.

I'd previously closed all comments on posts over 30 days old, across all 700 blogs on the installation, so I was dismayed to be getting comment spam still. How was it sneaking in? After looking through my logs for POST comments I pulled out a bunch of likely looking pages.

grep wp-comments-post access.log

OK so it seemed that although all the WP Posts were locked down, some Pages and some Media posts were still not locked down — the 30 day expiry thing must only apply to Posts. Grrr. The internet revealed no easy way to fix this so I looked in the database and crafted a query which would do this for me on one table …

UPDATE `wp_1_posts` SET `comment_status` = "closed", `ping_status` = "closed" WHERE `post_modified` < "2013-10-31 11:59:59"

Read more

WordPress Multisite Blog Mass Removal Script

I was moving a WPMU site to a new server and saw that the database had grown to about 250Mb, and there were about 700 blogs running on the server. I used a few database queries to pull out a list of which blogs I wanted to delete — basically any which had a creation date and last update date the same, and any with only one post etc — at which point I had a list of 300 blog IDs. So was I going to manually delete them all? Nope, I did what any sensible person did, and wrote a script to do it.

Read more

vnstat for webservers

This is quickly becoming one of my favourite tools when setting up webservers, after discovering it recently. I have all sorts of monitoring set up and use munin a lot, but vnstat seems to be a very lightweight daemon which gives you insight into the traffic to and from your box. Best of all it integrates well with logwatch, so it will send you a quick report every day so you can see immediately if something is going wrong.

Read more

UFW script for Logwatch

I enabled UFW on an Ubuntu server recently and started getting all manner of stuff in my logwatch reports. It activated a section called 'iptables' and started logging every line in syslog with [UFW BLOCK] in it. It was marginally interesting, but not really worth the space devoted to it, so I decided to write a little script to parse the UFW log and summarise the top Blocked Hosts and top Blocked Ports. Therefore I could easily see if there was a change in pattern.

Read more