Blog posts

Looking-up PHP sessions in memcached

Submitted by HighKing on Fri, 06/13/2014 - 09:57

If, like me, you use memcached primarily for storing php-sessions using the php-module 'memcache' or 'memcached', then you probably have no idea what's actually happening inside memcached. It took me some time to figure out simply how to lookup a php-session.

Like most things in life, the answer is actually pretty simple.

You need two things:
- The session name (can be found in php.ini / phpinfo()), usually just "PHPSESSID".
- The session id (I've used Firefox add-on "view cookies" to see mine).

Running a second MySQL-instance on the same Linux box

Submitted by HighKing on Tue, 12/03/2013 - 14:58

Sometimes it can be useful to be able to start a second mysqld-instance on the same machine, for example when you need to restore some innodb-tables but only have a file back-up available of the MySQL-instance on the machine.

When searching the Internet, many people offer solutions for this that use a chroot. Well... I don't like to build-up a whole chroot just to run a second MySQL-daemon! ;-)

Getting the date of last month in bash

Submitted by HighKing on Wed, 11/20/2013 - 11:00

I confess: I tend to overcomplicate things just because that's how I know how to do it.

Example: When I need the date of 2 months ago in a bash script, I usually do date +%s to get the current date and time in seconds since epoch, then subtract 5184000 seconds of that number (60 days) and then use the date command again to get the date formatted the way I want.

Make sendmail deliver messages in Maildir-format

Submitted by HighKing on Sat, 10/12/2013 - 19:18

This is very easy. As sendmail uses procmail to deliver messages locally, you just have to let procmail know you'd like to deliver messages in a directory instead of in a single file.

For this, create a file /etc/procmailrc and add the following line to it:


Now all messages will be delivered into a directory called "Maildir" in the users' homedir. No service restart required. As soon as the first e-mail message comes in the Maildir-directory and its contents will be automatically generated. :-)


Submitted by HighKing on Sat, 09/14/2013 - 20:01

I just found that it's possible to configure your ssh-client on a per-host basis. So, use this for host-a and that for host-b. For a while now, I was using "ServerAliveInterval 60" in my ~/.ssh/config, to make sure ssh connections don't die after a while.

Creating a two-node cluster with keepalived

Submitted by HighKing on Sat, 09/14/2013 - 19:55

While trying to balance packets over two hosts, where one of the hosts is both a load-balancer and a realserver, I bumped into an issue adding the local realserver to the setup.

Note that in this example I used as the VIP, as the local realserver and as the remote realserver.

Somehow, when I inserted both machine ip's as realserver only the remote machine got enabled:


Submitted by HighKing on Wed, 11/28/2012 - 19:41

Afgelopen zaterdag, 24 november, hebben we Daisy opgehaald. Daisy is een ragdoll en geboren op 29 augustus. Voor Shabby is het nog wel even wennen, die vind het wat eng, zo'n indringer. Gelukkig maakt Daisy zich nergens druk om en speelt lekker met alles dat ze vinden kan.

Pap, we zullen je missen.

Submitted by HighKing on Tue, 05/24/2011 - 10:14

Minder dan een jaar geleden is pap voor problemen met zijn ademhaling opgenomen in het ziekenhuis. Vocht leek de oorzaak. Na aftappen van een behoorlijke hoeveelheid vocht bleek dit helemaal vol kankercellen te zitten. Pap had longkanker en aan het vocht te zien bleek dit al behoorlijk te zijn uitgezaaid.

Een chemo kuur later ging het eigenlijk wel weer goed. Pap begon weer zin in het leven te krijgen. Ruilde zijn camper in voor een dikke V6 en genoot weer met volle teugen van het leven. Dit maakte ons ook weer positief.