Archive for April, 2006

Tightvnc viewer startup script

Wednesday, April 26th, 2006

Today, I wrote a little AutoIt script that connects to a vnc server when starting my windows computer. If you are interested, here you are!

Using bash variables in awk

Friday, April 21st, 2006

While there seems nothing wrong with this:

sign="--"
awk '{if ($1 == $sign ) print $1 }'

..it doesn’t give the intended result. To be able to use bash variables in awk, you first need to assign the variables with the -v option:

sign="--"
awk -v sign="$sign" '{if ($1 == sign ) print $1 }'

From the awk man page:

The option -v followed by var=value is an assignment to be done before (the awk) prog is  executed;  any  number  of  -v  options  may be present.

Questions and Answers!

Tuesday, April 11th, 2006

New nerd note section! Here you might find the answers you previously looked for when you where visiting nerdnotes.org.

For the moment you can find the ‘Q and A’ pages at the top right side. As it starts to grow, I’ll have to come up with another solution.

hdiutil

Saturday, April 8th, 2006

Met hdiutil kun je vanaf de command line eigenlijk alles doen wat je met ‘Disk Utility’ kan doen. Ook het dubbel klikken van een dmg bestand vanuit finder is een actie die je hiermee kunt automatiseren en dus ook vanaf afstand met ssh kan uitvoeren. Hieronder een voorbeeld hoe je AdiumX zou kunnen installeren:

$ wget http://adiumx.cachefly.net/AdiumX_0.89.1.dmg
$ hdiutil attach AdiumX_0.89.1.dmg
/dev/disk4      Apple_partition_scheme
/dev/disk4s1   Apple_partition_map
/dev/disk4s2   Apple_HFS                   /Volumes/Adium X 0.89.1
$ ditto /Volumes/Adium\ X\ 0.89.1/Adium.app /Applications/
$ open /Applications/Adium.app

Maar goed, wat is er nou makkelijker dan:
To install Adium, drag the duck to your Applications folder

Voor alle opties, zie ‘man hdiutil

vncmanager

Saturday, April 1st, 2006

When starting a vnc server, the vncserver script takes care of starting Xvnc with the right command line options. It returns the display number it has chosen for the new desktop session:

$ vncserver

New 'linuxbox:4 (me)' desktop is linuxbox:4

Starting applications specified in /home/user/.vnc/xstartup
Log file is /home/me/.vnc/linuxbox:4.log

It’s important to remember this number because you need it when using vncviewer or if you want to stop the server.
Well, not anymore when using vncmanager!!
Vncmanager integrates listing, starting and stopping vncservers. I initially wrote it to manage vncservers on a cluster of linux machines. The whole setup however, was quite site specific. The script basically queries all the linux nodes for information on running vncservers.
The version published here is adapted for use on a single machine.

The UI is done with dialog which allows you to display input boxes, menus etc. from shell scripts. For example, the following code generates the main menu of vncmanager:

        dialog  --backtitle "vncmanager"    \
                --title "Main menu"  \
                --output-fd 3             \
                --menu "What would you like to do:" 15 65 6 \
                1 "List my running VNC servers"   \
                2 "Start a VNC server"   \
                3 "Stop a VNC server"  \
                4 "Set my VNC password" \
                5 "Quit"

And what’s a new script without screenshots ;-)
screenshot of vncmanager

The multiple hosts version requires some work to make it less dependent on the cluster configuration. I’ll post it here soon.