diff --git a/indra/newview/linux_tools/handle_secondlifeprotocol.sh b/indra/newview/linux_tools/handle_secondlifeprotocol.sh
index 53d875ee0736dcf9a2d0435c39dc8c8ba910ea6a..5d63c4514e81f8dde2cbcc93467fbe2c4aeded49 100755
--- a/indra/newview/linux_tools/handle_secondlifeprotocol.sh
+++ b/indra/newview/linux_tools/handle_secondlifeprotocol.sh
@@ -1,17 +1,34 @@
 #!/bin/bash
 
-# Send a URL of the form secondlife://... to Second Life.
+# Send a URL of the form secondlife://... to any running viewer, if not, launch Alchemy viewer.
 #
 
+#enable or disable debugging code
+debug=0
+
 URL="$1"
 
 if [ -z "$URL" ]; then
-    echo Usage: $0 secondlife://...
+    echo "Usage: $0 [ secondlife://  | hop:// ] ..."
     exit
 fi
 
 RUN_PATH=`dirname "$0" || echo .`
-cd "${RUN_PATH}/.."
-
-exec ./alchemy -url \'"${URL}"\'
+#ch "${RUN_PATH}"
 
+# Use pgrep to return the NUMBER of matching processes, not their IDs. Stragely returning IDs via pidof will cause the script to fail at random, even when it shouldn't.
+# pgrep -c returns 0 to show if process (any matching viewer) is not running, 
+if [ `pgrep -c do-not-directly` != 0 ]; then
+	if [ $debug == 1 ]; then
+		zenity --info --text="pgrep passed\!" --title="secondlife_protocol"
+	fi
+	exec dbus-send --type=method_call --dest=com.secondlife.ViewerAppAPIService /com/secondlife/ViewerAppAPI com.secondlife.ViewerAppAPI.GoSLURL string:"$1"
+else
+	if [ $debug == 1 ]; then
+		zenity --info --text="pgrep fail\!" --title="secondlife_protocol"
+	fi
+	cd "${RUN_PATH}"/..
+	#Go to .sh location (/etc), then up a directory to the viewer location
+	exec ./alchemy -url \'"${URL}"\'
+fi
+`