Changeset 1175 for trunk/autoquest-htmlmonitor
- Timestamp:
- 04/24/13 11:46:58 (12 years ago)
- Location:
- trunk/autoquest-htmlmonitor/bin
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-htmlmonitor/bin/run.sh
r876 r1175 1 1 #!/bin/sh 2 # Copyright 2012 Georg-August-Universität Göttingen, Germany 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 17 18 # This script starts the autoquest-htmlmonitor which is in the same folder as 19 # this script 20 21 # Absolute path to this script, e.g. /home/user/bin/foo.sh 22 SCRIPT=$(readlink -f $0) 23 24 # Find the autoquest-htmlmonitor JAR-File and start in the Folder of this Script 25 JAR_FILE=`find $(dirname $SCRIPT) -type f -name 'autoquest-htmlmonitor-*.jar'` 26 27 # Get the ProcessID of the autoquest-htmlmonitor which is in the same folder as this script 28 PID=$(ps ax | grep "$JAR_FILE" | grep -v ' grep ' | awk '{print $1 " " $7}') 29 30 31 # Check if this autoquest-htmlmonitor is already running 32 if [ ! -z "$PID" ]; then 33 echo "autoquest-htmlmonitor is running with PID:$PID" 34 exit 1 35 fi 36 37 2 38 3 39 HOME_DIR=`dirname $0` … … 98 134 cd ${HOME_DIR} 99 135 100 JAR_FILE=`find . -type f -name 'autoquest-htmlmonitor-*.jar'`101 136 102 137 if [ ! -f "$JAR_FILE" ] ; then … … 106 141 fi 107 142 108 exec "$JAVACMD" -jar "${JAR_FILE}" $* 143 # If the logdir was given to the script: Use it but test if it exist 144 # if not, create it 145 if [ ! -z "$1" ] ; then 146 LOGDIR="$1" 147 if [ -d "$LOGDIR" ] ; then 148 echo "Using LogDir $LOGDIR" 149 else 150 echo "Creating Folder $LOGDIR" 151 mkdir "$LOGDIR" 152 fi 153 else 154 # ./log is the standard log file. If this folder does not exist 155 # create it 156 if [ ! -d "./log" ] ; then 157 mkdir "./log" 158 fi 159 LOGDIR="./log" 160 echo "Using LogDir ./log" 161 fi 162 163 164 # Every output from the JAR File will be saved in the Console.log 165 # &1 is stdout, &2 is stderr 166 echo "Starting autoquest-htmlmonitor" 167 exec 3>&1 4>&2 >>"$LOGDIR"/Console.log 2>&1 168 exec "$JAVACMD" -jar "${JAR_FILE}" "$LOGDIR" 169 # restore stdout and stderr 170 exec 1>&3 2>&4
Note: See TracChangeset
for help on using the changeset viewer.