Linux

How to append values to an array in bash

Last week I was working on a bash script for a project at work. The script parsed through a log file with server load and disk usage statistics at regular intervals. The script was calculating the average CPU idle time, disk utilization, and disk usage for servers. After calculating the averages for each of these three metrics, I then proceeded to loop through all the lines in the file and create an array of all the times when the CPU idle time was below average, or the disk utilization or usage was above average.
Read the rest of this entry »

Top 20+ MySQL Best Practices

I came across an excellent article a couple days ago in my NetTuts+ RSS Feed titled “Top 20+ MySQL Best Practices”. In the article, author Burak Guzel gives some excellent MySQL tips. Due to my argumentative nature (not really) I made a few comments on the post that you can see at the bottom about 1 or 2 of the tips. The tips were by no means wrong, I just wanted to add some clarification and caveats to them. A couple of the tips, I have been using every single day in my job and they have proven invaluable. The article is excellent and I highly recommend reading it.
Read the rest of this entry »

Avoid WordPress StatPress plugin like the plague!

The WordPress plugin StatPress is an absolutely horrid plugin to use. Yes, I said it…horrid! After seeing many people praising this plugin on their sites, this is a bold statement.
Read the rest of this entry »

Temporary Tables are Bad!

This article was written by a co-worker of mine and I wanted to share with everyone else.

Temporary Tables. What are they? Why are they bad? You might think you don’t explicitly use any, but in actuality you may be using them all the time.

Temporary tables come in two flavors. The kind you know you’re making, and the kind you don’t. You know you’re making a temporary table when you use the CREATE TEMPORARY TABLE syntax. On the other hand, there are lots of other cases in which MySQL will create a temporary table for you, in the background, to help out the query execution to get you your results.
Read the rest of this entry »

Could the new Google Chrome OS spell the end of the Desktop PC as we know it?

Maybe, but doubtful I think. But there are people that are saying this. This past week, Google released the source code for their new Chrome OS (called Chromium while still in development). The OS is still in development, expected to be released next year, but is Google’s “attempt to re-think what operating systems should be.” (source: The Official Google Blog)
Read the rest of this entry »

How to fix a ‘403 Forbidden’ error on your website

So you’re working on your website and you go to test it and you get a big nasty message that says something to the effect of
Forbidden
You don't have permission to access / on this server.

What did you do? Better yet, what do you do.
Read the rest of this entry »

How to Post to Twitter from a Linux Shell

I had a little downtime today and work and decided to write a shell script that I could use to tweet from the shell of my Linux server. The reason is that Twitter is one of many social networking sites that is blocked at my workplace. However, I do have access to my server and found a great one-liner on commandlinefu.com to update twitter via curl. I decided to expand on this a bit and wrote a shell script that offers a bit more than merely posting a tweet. Check out my shell script to post to Twitter here.

How to Create a File of a Specific Size on Linux

I was doing some testing the other night of a web-based file uploader I had built into one of the websites I had developed. The website is hosted on a GoDaddy.com shared hosting account
GoDaddy.com Shared Hosting and allows my client to upload images, videos, and documents to her website directly through the browser. We had been running into a problem though with some files not uploading properly and I had a feeling it had to do with PHP limits imposed by the server. Even though I had raised the limits in a php.ini file, I thought those might be getting overwritten by the server.
Read the rest of this entry »

How to Configure an Alternate Port for Qmail

I had initially posted instructions on how to change the default Qmail port. However, an associate of mine pointed out the fallacy in my instructions. Changing the default Qmail port will prevent email from being delivered to your server as foreign mail servers will try to connect to your server on port 25 and if you change it, you won’t be able to receive email. I completely forgot about that little side effect when I posted this and have thus changed this post to only show how to configure an alternate port for Qmail.

A couple days ago I wrote about how to troubleshoot an email server when it isn’t working. This post isn’t necessarily follow-up to that, but more of a corollary. One of the things I didn’t mention in that post is what to do if you are running an email server and your ISP does not allow outgoing connections over port 25, the standard SMTP port. Many ISP’s have this policy to cust down on Spam sent through their servers, mine included. So when I tried to connect to my email the other day through Mozilla Thunderbird, I ran into a problem. I knew what I had to do. I had to configure Qmail to use an alternate port.
Read the rest of this entry »

2 SUREFIRE ways to test if your email is working

We’ve all ran into those problems where all of our sudden, we can’t send email and we don’t know why, and don’t know what to do, besides call our email provider. One thing I’ve been focusing on at work lately is empowering our customers to “take ownership” of their servers, to help them figure things out on their own. The way I put it, being a server administrator is like getting married; “through good times and bad.” The problem is most administrators (or wannabe administrators) only want to be the admin when the server is running. Once there’s a problem, they expect us to be the admin. Sorry folks, but that’s not how it works.
Read the rest of this entry »