How to change the time anacron runs.

Well this one took me a while to figure out, so I thought I'd blog about it in case I could save someone else some time. Anacron is installed on desktop / laptop orientated distributions as they're often switched off. It basically makes sure the daily, weekly and monthly cron jobs are run by checking … Read more

Ubuntu / Mint gvfsd-metadata kill script.

I've always had trouble with gvfsd-metadata. Not that I know what it actually is, I just know that once or twice a day my computer will become unresponsive, and the culprit is this little program running around in the background, doing whatever it does, and pegging my CPU up to 100%. I've searched many forums. A lot of people are affected, but there doesn't really seem to be any solution, or any clear reasons why it happens.

So what I usually do is open up a Terminal, run top and see that gvfsd-metadata is at the top of the list redlining my CPU. From there, I press k to kill it (if its the topmost item, its PID will be automatically selected, otherwise enter the PID manually), and then retain the suggested kill signal value of 15. Not a terribly hard process, but as the CPU is maxed out, then opening a Terminal window and top can take a few minutes. Its that sluggish. So, like you do, I whipped up a quick script to handle this automatically, which I run every 5 minutes.

Read more

Notes on Encrypted /home directory, post install.

I decided to encrypt the /home directory on a notebook, post install, as I was going to take it out of the house. There's nothing too important on it, but I probably should look after my ssh keys at least! The laptop is a low end Dell, running Mint (based on Ubuntu). It has a slightly odd configuration in that I have the /home partition mounted separately.

OK, so the first thing I did was to copy the big files onto a separate, non-encrypted partition. I did this for two reasons. Firstly the encryption process creates a copy of your home directory which you can roll back to. This means in your /home partition you need enough room for two copies of your home dir. I didn't. Secondly, the encryption process obviously encrypts each file as it goes. I thought by moving out the large files (Music and Videos directories basically), that this would speed up the encryption process.

Read more

mysql not starting – errno: 24 – Too many open files

This was a really strange one and might be peculiar to debian servers. I was trying to change a couple of mysql default settings, so after editing the config file, I restarted mysql on a webserver and it didn't come back up again. There were a bunch of errors in the /var/log/mysql.log saying "errno: 24 – Too many open files". And in fact mysql was so busy pumping these errors out, that it didn't have time to do any databasing on the files it was able to open.

After a bit of experimentation (read 'panic'), I discovered that rebooting the server started mysql up fine, but doing a 'service mysql restart' produced the file errors, so I rebooted and left it running while I investigated.

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