Happy New Year and Updates

With it being the festive season, I have not done a huge amount of interest recently. I’m hoping to have a few things for you soon. Currently I have been experimenting with Drupal, having never used it (properly) before, this is a real learning curve.

Also I am working on getting suPHP to work with userdir, to allow users of a server to have their own webspace in a secure fashion. I will be blogging about this when it is done.

However, I have found a few things that may be of interest:
Things you probably didn’t know about PHP – Some really interesting and neat things you can do with PHP.

PHP Object Generator – Generates class structures and objects, so you don’t have to

Arithmetic in Bash

Bash is not exactly brilliant at performing numerical calculations. Recently I’ve required the need to see how many people are currently logged in on the terminal servers through NX. Now, if people are logged in via standard SSH, then it’s quite easy to count:

who | wc -l

However, if you want to perform a line count of the NX list, you have 6 lines at the top which are not part of the count. In order to perform this subtraction, we need to do a calculation. To do this in bash we use a $(()):

echo $((2 + 2))

So, if we were to use this when performing the command on nxserver, this is how it would look in the end:

echo $(($(/usr/NX/bin/nxserver --list | wc -l) - 6))

Or, if you’re not running this script as root (and using sudo):

echo $(($(sudo /usr/NX/bin/nxserver --list | wc -l) - 6))