Bug 6027 - Can't start karaf using symbolic link
[controller.git] / karaf / opendaylight-karaf-resources / src / main / resources / bin / instance
index ca6f33439bf65d3ef06f61a5a99f86560e022b33..d7a344c483045c0e8f898a672d1e350174de0a12 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 #    Licensed to the Apache Software Foundation (ASF) under one or more
 #    contributor license agreements.  See the NOTICE file distributed with
 #    limitations under the License.
 #
 
-DIRNAME=`dirname "$0"`
-PROGNAME=`basename "$0"`
+REALNAME=`readlink -e "$0"`
+if [ $? != 0 ]; then
+    REALNAME=$0
+fi
+DIRNAME=`dirname "$REALNAME"`
+PROGNAME=`basename "$REALNAME"`
 
 #
 # Sourcing environment settings for karaf similar to tomcats setenv