1#!/usr/local/bin/bash
2
3usage(){
4echo "
5Written by Brian Bushnell
6Last modified December 19, 2018
7
8Description:  Parses a webcheck log.
9Input is expected to look like this:
10Tue Apr 26 16:40:09 2016|https://rqc.jgi-psf.org/control/|200 OK|0.61
11
12Usage:  webcheck.sh <input files>
13
14
15Standard parameters:
16in=<file>       Primary input.  Can use a wildcard (*) if 'in=' is omitted.
17out=<file>      Summary output; optional.
18fail=<file>     Output of failing lines; optional.
19invalid=<file>  Output of misformatted lines; optional.
20extendedstats=f (es) Print more stats.
21overwrite=f     (ow) Set to false to force the program to abort rather than
22                overwrite an existing file.
23
24Java Parameters:
25-Xmx            This will set Java's memory usage, overriding autodetection.
26                -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will
27                specify 200 megs. The max is typically 85% of physical memory.
28-eoom           This flag will cause the process to exit if an out-of-memory
29                exception occurs.  Requires Java 8u92+.
30-da             Disable assertions.
31
32Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems.
33"
34}
35
36#This block allows symlinked shellscripts to correctly set classpath.
37pushd . > /dev/null
38DIR="${BASH_SOURCE[0]}"
39while [ -h "$DIR" ]; do
40  cd "$(dirname "$DIR")"
41  DIR="$(readlink "$(basename "$DIR")")"
42done
43cd "$(dirname "$DIR")"
44DIR="$(pwd)/"
45popd > /dev/null
46
47#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
48CP="$DIR""current/"
49
50z="-Xmx1g"
51set=0
52
53if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then
54	usage
55	exit
56fi
57
58calcXmx () {
59	source "$DIR""/calcmem.sh"
60	setEnvironment
61	parseXmx "$@"
62}
63calcXmx "$@"
64
65webcheck() {
66	local CMD="java $EA $EOOM $z -cp $CP driver.ProcessWebcheck $@"
67	echo $CMD >&2
68	eval $CMD
69}
70
71webcheck "$@"
72