#!/bin/bash

# default values
SLEEP=300
GRAPH=1800
NICE=19
OUT="stats.html"
TMP="stats2-$$.html"
RUNONCE=0
GRAPHS=1

# RUBY settings
: ${TOOLCHAIN_RUBY_VERSION:=1.9.2-p290}
RUBY=/build/toolchain/lin64/ruby-$TOOLCHAIN_RUBY_VERSION/bin/ruby
if [ ! -x $RUBY ]; then
   echo "Can't find $RUBY."
   exit 1
fi

export RUBY_LIB=/mts/git/ruby_gnuplot/lib
if [ ! -r $RUBY_LIB ]; then
   echo "Can't find $RUBY_LIB."
   exit 1
fi

# GNUPLOT Settings
: ${TOOLCHAIN_GNUPLOT_VERSION:=4.2.5}
if [ "X"$(which gnuplot) == "X" ]; then
   GNUPLOT=/build/toolchain/lin32/gnuplot-$TOOLCHAIN_GNUPLOT_VERSION/bin
   if [ ! -x "$GNUPLOT/gnuplot" ]; then
      echo "Can't find $GNUPLOT."
      exit 1
   fi
   export PATH=$PATH:$GNUPLOT 
fi

exec nice -n $NICE env RUBYLIB=$RUBY_LIB $RUBY $(dirname $0)/stress-vpx-json-analyse.rb $*
