Index: /trunk/autoquest-htmlmonitor/bin/isRunning.sh
===================================================================
--- /trunk/autoquest-htmlmonitor/bin/isRunning.sh	(revision 1175)
+++ /trunk/autoquest-htmlmonitor/bin/isRunning.sh	(revision 1175)
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+#   Copyright 2012 Georg-August-Universität Göttingen, Germany
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+
+
+# This script checks if the autoquest-htmlmonitor, which is in the same folder as
+# this script, is running
+
+
+# Absolute path to this script, e.g. /home/user/bin/stop.sh
+SCRIPT=$(readlink -f $0)
+
+# Find the autoquest-htmlmonitor JAR-File and start in the Folder of this Script
+JAR_FILE=`find $(dirname $SCRIPT) -type f -name 'autoquest-htmlmonitor-*.jar'`
+
+# Get the ProcessID of the autoquest-htmlmonitor which is in the same folder as this script
+PID=$(ps ax | grep "$JAR_FILE" | grep -v ' grep ' | awk '{print $1}')
+
+if [ -z "$PID" ]; then
+  echo "autoquest-htmlmonitor is not running"
+else
+  echo "autoquest-htmlmonitor is running with PID: $PID"
+fi
+
Index: /trunk/autoquest-htmlmonitor/bin/run.sh
===================================================================
--- /trunk/autoquest-htmlmonitor/bin/run.sh	(revision 1174)
+++ /trunk/autoquest-htmlmonitor/bin/run.sh	(revision 1175)
@@ -1,3 +1,39 @@
 #!/bin/sh
+#   Copyright 2012 Georg-August-Universität Göttingen, Germany
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+
+
+# This script starts the autoquest-htmlmonitor which is in the same folder as
+# this script
+
+# Absolute path to this script, e.g. /home/user/bin/foo.sh
+SCRIPT=$(readlink -f $0)
+
+# Find the autoquest-htmlmonitor JAR-File and start in the Folder of this Script
+JAR_FILE=`find $(dirname $SCRIPT) -type f -name 'autoquest-htmlmonitor-*.jar'`
+
+# Get the ProcessID of the autoquest-htmlmonitor which is in the same folder as this script
+PID=$(ps ax | grep "$JAR_FILE" | grep -v ' grep ' | awk '{print $1 " " $7}')
+
+
+# Check if this autoquest-htmlmonitor is already running
+if [ ! -z "$PID" ]; then
+  echo "autoquest-htmlmonitor is running with PID:$PID"
+  exit 1
+fi
+
+
 
 HOME_DIR=`dirname $0`
@@ -98,5 +134,4 @@
 cd ${HOME_DIR}
 
-JAR_FILE=`find . -type f -name 'autoquest-htmlmonitor-*.jar'`
 
 if [ ! -f "$JAR_FILE" ] ; then
@@ -106,3 +141,30 @@
 fi
 
-exec "$JAVACMD" -jar "${JAR_FILE}" $*
+# If the logdir was given to the script: Use it but test if it exist
+# if not, create it
+if [ ! -z "$1" ] ; then
+  LOGDIR="$1"
+  if [ -d "$LOGDIR" ] ; then
+    echo "Using LogDir $LOGDIR"
+  else
+    echo "Creating Folder $LOGDIR"
+    mkdir "$LOGDIR"
+  fi
+else
+  # ./log is the standard log file. If this folder does not exist
+  # create it
+  if [ ! -d "./log" ] ; then
+     mkdir "./log"
+  fi
+  LOGDIR="./log"
+  echo "Using LogDir ./log"
+fi
+
+
+# Every output from the JAR File will be saved in the Console.log
+# &1 is stdout, &2 is stderr
+echo "Starting autoquest-htmlmonitor"
+exec 3>&1 4>&2 >>"$LOGDIR"/Console.log 2>&1
+exec "$JAVACMD" -jar "${JAR_FILE}" "$LOGDIR"
+# restore stdout and stderr
+exec 1>&3 2>&4
Index: /trunk/autoquest-htmlmonitor/bin/stop.sh
===================================================================
--- /trunk/autoquest-htmlmonitor/bin/stop.sh	(revision 1175)
+++ /trunk/autoquest-htmlmonitor/bin/stop.sh	(revision 1175)
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+#   Copyright 2012 Georg-August-Universität Göttingen, Germany
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+
+
+# This script stops the autoquest-htmlmonitor which is in the same folder as
+# this script
+
+
+# Absolute path to this script, e.g. /home/user/bin/stop.sh
+SCRIPT=$(readlink -f $0)
+
+# Find the autoquest-htmlmonitor JAR-File and start in the Folder of this Script
+JAR_FILE=`find $(dirname $SCRIPT) -type f -name 'autoquest-htmlmonitor-*.jar'`
+
+# Get the ProcessID of the autoquest-htmlmonitor which is in the same folder as this script
+PID=$(ps ax | grep "$JAR_FILE" | grep -v ' grep ' | awk '{print $1}')
+
+if [ -z "$PID" ]; then
+  echo autoquest-htmlmonitor is not running
+else
+  #Kill this autoquest-htmlmonitor-process
+  kill "$PID"
+  # Check if Process is no more
+  CHECK=$(ps ax | grep "$JAR_FILE" | grep -v ' grep ' | awk '{print $1}')
+  if [ ! -z "$CHECK" ]; then
+	kill -9 "$CHECK"
+  fi
+  echo autoquest-htmlmonitor stopped
+fi
+
