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