#!/bin/bash
appdir=`pwd`

 if [ -e "$appdir/sv.lock" ]; then
  echo "Service could not be started. Please check the logfiles."
  exit 1
fi

export LD_LIBRARY_PATH=$appdir:\${LD_LIBRARY_PATH}
echo "Starting Shockvoice Service using Mono"

if [ -e "$appdir/sv.lock" ]; then
  echo "Please delete $appdir/sv.lock file and start over"
    exit 1
else
    echo "Starting service ..."
fi

/opt/mono-2.4.3/bin/mono /opt/mono-2.4.3/lib/mono/gac/mono-service/2.0.0.0__0738eb9f132ed756/mono-service.exe -l:$appdir/sv.lock "$appdir/shockvoice_service.exe"  >$appdir/svoutput.log 2>$appdir/sverrors.log &
sleep 2
