#!/bin/bash

_script_root=$(cd "$(dirname "$0")"; pwd)

#export JAVA_HOME="/usr/local/java8"

me=`whoami`
if [ ${me} != game ];then
   echo "ERROR su game please !!!"
   exit 1
fi

_pid=`ps -ef| grep ${_script_root} | grep -v $0 |grep -v grep | awk '{print $2}' `
if [ "${_pid}k" == "k" ];then
  #nohup ${JAVA_HOME}/bin/java -Xmx20m -cp ${_script_root}/conf:${_script_root}/lib/*:/lib/* -Djava.library.path= org.apache.flume.node.Application -n agent -f ${_script_root}/conf/collector.properties  &>/dev/null &
  nohup java -Xmx20m -cp ${_script_root}/conf:${_script_root}/lib/*:/lib/* -Djava.library.path= org.apache.flume.node.Application -n agent -f ${_script_root}/conf/collector.properties  &>/dev/null &
  ps -ef| grep ${_script_root} | grep -v $0 |grep -v grep
else
  echo "ERROR collector is runing !!!"
fi

