make the bash scripts more resilient to symlinks

As it currently stands on 1.4.0-beta1, you can't symlink to the logstash script as it breaks the basedir variable. It seems like supporting symlinks would be a pretty common way to install logstash.

This patch uses a bit more bash to properly resolve basedir so that it handles symlinks.

This bash is lifted from the stackoverflow post: http://stackoverflow.com/questions/59895/can-a-a-script-tell-what-directory-its-stored-in, except for basedir doing one more cd ..

Obviously, this isn't very dry, perhaps a better solution is possible?