Help launch script find its home when symlinked

dirname is not enough when the launch script is linked into e.g.
/usr/local/bin/umongo.