Adventures in Red Hat Enterprise Linux, CentOS, Fedora, OpenBSD and other open source solutions.

Telnet trick on shell command prompt

Here is a simple telnet trick, so check if a port is open and responding as expected. Be aware that the check described here is a bit simplistic, but it does demonstrate the capabilities of telnet on the shell.

$ smtpserver="smtp"
$ smtpport="25"
$ ( echo open $smtpserver $smtpport ; sleep 1 ; echo quit ) | telnet 2>&1 | grep 220 > /dev/null 2>&1
$ echo $?

This will print "0" when everything is correct, and 1 when the grep did not work.

If social networks were companies

Imagine the rules of a social network would apply to corporate enterprises, these strange situations would arise:

  • The boss and your manager would be chosen by you and your colleagues.
  • Your manager or boss would be extremely popular today, but would be so yesterday tomorrow.
  • Just like StumbleUpon traffic, it would be extremely busy with visitors this week, while next week could be so quiet.
  • Your boss would be well connected on Linked In, have loads of friends on FaceBook and would own a huge area in My Space.
  • You would spends hours trying to gain friends and fans in order to become boss tomorrow.
  • Bosses over 40 would be thrown out tomorrow, colleagues of 19 or younger would determine the long term strategy.
  • Being in the coffee corner for more than an hour would actually help your career.

Wow, that would actually be a very positive thing!

Sustaining busy times with Apache

When administering an Apache web server, you will encounter moment when some of your clients, but hopefully you, published something that causes a rush of visitors to your web server. How do you manage that peak? Here are some tricks that you could use:

1. Limit the available slots

Apache has many performance related configuration options. When you run a small server, the default configuration of Apache might cause requests to be answered very slowly.
Apache runs on a desktop-comparable machine for my website, so I have altered these settings. The impact of this change was huge! Where the default settings would cause extreme high (100+) loads and extremely slow request, the web server runs healthy now.

StartServers         16
MinSpareServers      8
MaxSpareServers      32
ServerLimit          32
MaxClients           32
MaxRequestsPerChild  4000

At first this might scare you off; allowing less connections, but you will have to realize that a small server can't cope with 100+ simultaneous connections. Limiting the amount of connections will speed up the connected clients. Clients that visit your web server during busy times will have to wait a few seconds before being served.

2. Check the /server-status page

Configure Apache to allow you to see the status pages. This will help you identify what is using all the resources.

ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from

And run apachectl status and lynx http://localhost/server-status for extended information. Onlamps website explains what these values mean.

3. Move services to different machines

When you are in deep shit, move services like the database, email, domain name resolution, etc to a different machine. This will help you spread the load and will also help you identify where the problem exactly is.

4. Optimize code

After figuring out what virtual host eats all CPU cycles or available memory, check to see the (php) code. If you are not comfortable with it, let the user (and owner) do this. He/she is responsible for hir/her code.
This is the most difficult step to take and is in a gray area; it's not system administration, but sure comes close.

Coping with visitors statistics in Drupal

Drupal users might agree: Drupal does not provide sufficient statistics to get a good overview of what their visitors are doing. Here are some ways to get the most out of your statistics using Drupal.

Enable the Statistics module. It comes with Drupal and the only thing it does is keep counters of what nodes are read. Other information is stored, but so difficult to find, that I consider it useless.

Use Google Analitics

There is a Drupal Google Analytics module that you can install. Besides that, you also need a Google Analytics account.
Installation is simple; enable the module, get yourself a Google Analytics account and copy the code into drupal. That code looks something like this: UA-1234567-1

Use SQL to extract some statistics

Write your own code to see what stories are popular. I use this code, but you might need to adapt it a little:

<tr><td><b>Article</b></td><td><b>Views today</b></td><td><b>Total views</b></td><td><b>Author</b></td></tr>
= mysql_query("SELECT node.nid, node.title, node_counter.daycount, node_counter.totalcount, FROM node, node_counter, users WHERE node.nid=node_counter.nid AND users.uid=node.uid AND (node.type=\"story\" OR node.type=\"book\") ORDER BY node_counter.totalcount DESC LIMIT 3;");
while (
$row = mysql_fetch_array($result, MYSQL_NUM)) {
"<tr><td><a href=\"/node/$row[0]\">$row[1]</a></td><td><a href=\"/node/$row[0]/track\">$row[2]</a></td><td>$row[3]</td><td>$row[4]</td></tr>";


Adventures in GPL

I did a little game development back in the day. Nearly every programmer, at one point or another, has at least thought of producing the next hot game to hit the shelves. The way I started was to work with MUDs (Multi-User Dimensions) by editing the source code of premade game frameworks (code bases). All of the code bases I picked through had a special license called the DIKU license; the reason is that DIKUMUD was the first of this huge family tree of code bases. You could edit and distribute the code all you want, but you couldn't profit off of it commercially, and every time someone added even the most basic set of snippets onto the code, they would make a whole new code base and a special license that goes with the DIKU license. So, by the time you get to a third or fourth generation code base, you've got a novella of licenses to read through before you can even mess with it.

Then I discovered the GNU Public License. GPL is an extremely common license to run across these days, so it's worth a quick read so you know what's up. There's some really nice pluses to using GPL code in your project as well: the license is uniform, the code is free, and you can use it commercially! A common misconception is that GPL licensed software can't possibly be commercial because it's open source, so people will not pay you for the game. Yes, the code will be open for people to see and modify if it's GPL, but you can still turn a very nice buck. First off, the graphics, sound, and everything else that you've created which isn't code will be your property, and you don't have to distribute it. Second, if it's an MMOG (Massive Multiplayer Online Game), you can charge a monthly fee, sell schwag, and all sorts of other options.

small screenshot of a game using the Crystal Space engineOne of the engines to come out under the GPL license is the Crystal Space engine, and you can find some very nice screen shots and demos on the website that show the engine off. There have been commercial games, online games, and your general open source free-as-in-beer games to be developed with Crystal Space. There's plenty of other engines out there as well including: Axiom, Daimonin, Delta3D, Entropia Engine and the list goes on and on. The downside is that you won't be able to effectively produce an offline shelf-game and charge an insane rate for it like most game publishers do--people can just download the source code, compile it, and pirate the graphics. However, even if you had proprietary code, they would just go ahead and pirate the binaries anyway, so you'd be up the creek. At least with GPL, you earn cool points for releasing your code for the common good instead of getting ripped off by pirates.

Anonymous browsing using a hosted PAC file

A sketch of how a proxy worksAs a public service, Me in IT Consultancy is offering a hosted Proxy Automatic Configuration (PAC) file. That means you can configure your web browser once to use this PAC file, and from then on surf the web anonymously.

How to set it up in 1 minutes

This is really simple, the greater picture is that you have to tell your web browser where the PAC file can be found. The browser will get that file, and use the proxies that are listed in there.

Mac OS X - Safari and possibly other browsers

Mac OS X sets a proxy at the level of a network configuration, so it's not a specifically Safari configuration item.

  1. Go to System Preferences found under the apple icon in the left top.
  2. Select the network you use and click Advanced.
  3. Select the Proxies tab and change Configure Proxies: Manually to Using a PAC file.
  4. Enter the PAC File URL:

Windows/Linux - Firefox

  1. Click Tools, Options.
  2. At the Network tab, Settings button.
  3. Set the bottom Automatic Proxy Configuration URL to

How it works

Every now and then the PAC file is regenerated, only using the working proxies, and removing the slow or not working proxies. Your browser gets that PAC file when it starts up, to always uses a fresh copy.


Most troubles are not specifically related to using a PAC file, but relate to using an anonymous proxy in general. Even though, here are the troubles I ran into.

1. Some proxies have restrictions like not being able to post things. Even a simple Google search may be broken then. This is a limitation of this setup, posting can be considered dangerously.

Choosing a good domain name

It can be difficult to find yourself a good domain name. Besides that, what is the influence of a domain name on your visitors and search engines? How do you deal with multiple domains and should you have multiple domains? Let's go over these items.

  1. Keep it short. Long domain names are not easy to remember. Keep in mind that most visitors will not just type in your domain name, they will find it through Google, Yahoo or other websites. In my case for example, only 6% of the visitors come to my website by typing in the domain name. 12% comes to this website through search engines, 82% comes here by clicking on a link on another website.
  2. Use a name that suits your goal. What do you want to do with your website? Try to translate that "mission" into domain. This can be difficult, as you want to keep your domain short. Search engines heavily judge your website on a few items:
    1. What other have to say about your website.
    2. What words can be found in the URL.
    3. What words can be found in the title and meta tags.
    4. What words can be found on the page itself.
  3. Promote only one domain. Search engines tend to discover how important a website is, but counting the links to your website. If you have several domains in use, not redirecting to a single domain, search engines like Google will spread the importance of your website over all these domains. Focus on one domain, redirect everything other domain to that single domain.
  4. Have links to all your domains. If you have more than one domain, link to them from your main domain. In my case, I refer to these domains in articles like these. My main domain (now) is Me in IT Consultancy, but I have Me in IT Consultancy dot com, Me in IT Consultancy dot eu, Robert de Bock, Drupal dot nl, Linux Consultancy and Linux Consultant all redirecting to

Having multiple domains is not specifically good for your websites internet presence. I am sure you could just as well use a single domain, instead of buying a few. There are a few reasons why you could want to have multiple domains:

  • Catching typos. Think of domain names that contain then or than
  • Preventing others from using what seems to be your domain. Image and
  • Buying domains to hopefully sell them later.I do not think this is a good strategy, but maybe you do.

Simple checks to detect phishing websites

Some time ago I was asked to use a service called Moneybookers. At first I was a bit skeptic to use this service.

How do you check if an online service if safe to use?

  1. Check StumbleUpOn about Moneybookers. Social networks can be used to see how trustworthy services are!
  2. Check the SSL certificate. Check if the URL is really what you wanted to visit.
  3. Check Wikipedia on Moneybookers. Wikipedia does not tell you the truth, but chances are high that the public wrote something sensible.

Added another few domains to this (Drupal) website

I have added these few domains to point to this website,
Looking for our wedding site?

Here are the steps to take when adding a (few) domain(s). These steps make your domain jump through to your 1 and only domain you are using. For your Google Page Rank, it's better to concentrate all (sub-)domains instead of spread your Page Rank over many websites.

  1. Register the domain. Do it anywhere you like.
  2. Setup the domain name (DNS) Make www and @ (That is a reference to just the domain, without www.)
  3. Setup apache On the bottom you will find the virtual host configuration I use.
  4. Restart apache With a command like /usr/sbin/apachectl graceful or anything else.
  5. Setup .htaccess Make all domains go to one domain.

That's it. For reference purpose, here are the codes used.

Example part of httpd.conf. The bottom 4 lines were added.

<VirtualHost *:80>
ServerAdmin [email protected]nl
DocumentRoot /var/www/virtualhosts/meinit/html
ErrorLog /var/www/virtualhosts/meinit/logs/error_log
CustomLog /var/www/virtualhosts/meinit/logs/access_log common
ServerAlias *
ServerAlias *
ServerAlias *
ServerAlias *
ServerAlias *
ServerAlias *
ServerAlias *
ServerAlias *

A part of my .htaccess. Everything is redirected to

  RewriteCond %{HTTP_HOST} ^linux-consultant\.nl$ [NC]
  RewriteRule ^(.*)$$1 [L,R=301]
  RewriteCond %{HTTP_HOST} ^linux-consultancy\.nl$ [NC]
  RewriteRule ^(.*)$$1 [L,R=301]

5 reasons why commands are better than graphical user interfaces

A screenshot of a Windows terminalYesterday, I spoke to a (mostly Windows) colleague. He told me that system administration with a mouse is ease, "because you just try to change something, if it acts unexpected, you reboot."

I do not agree with that but could not make it clear to him why the command line is a better media to administer a system. Therefore, here is a list of comments you could give when you are asked the same question.

  1. Know what you are doing. A command line interface (CLI from now on) is scary. Just like an artist you have to start with a white sheet. (Read "black terminal".) My personal tendency when want to setup things is to use the man command often to read what commands can do.
  2. Undoing can be more natural. When setting up/changing things, one of the first things I want to know is how to undo things. Sometimes this can be a reboot but in 99% of the cases there is a command to flush/delete/undo/roll-back/etc.
  3. Automation is possible. When you can do/see something on the command-line, you can script it! Whenever I need to do something 2 (possibly more) times, I make a small script so I don't have to thing about it next time.
  4. Documentation is easier. Well, this is personal, but I think it's easier to copy-paste commands then to paste screen shots.
  5. A good keyboard does not cause RSI. A mouse (unless a good one) tends to cause RSI more.

I must be honest, there are some things that just should be used graphically, like an email client. No way mutt or pine are better. A chat client should also be graphical, all those windows...

Syndicate content