start.sh 630 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. DIRECTORY=`dirname $0`
  2. echo $DIRECTORY
  3. INIFILEDIR=$1
  4. HOMEDIR=$DIRECTORY
  5. cd $DIRECTORY
  6. if [ "$HOMEDIR" == "" ] ; then
  7. HOME=$(pwd)
  8. else
  9. HOME=$HOMEDIR
  10. fi
  11. LOG=$INIFILEDIR/logs
  12. LOGFILE=$INIFILEDIR/logs/log.txt
  13. EXEFILE=$HOME/fss
  14. pid="pid"
  15. if [ "$INIFILEDIR" == "" ] ; then
  16. echo "Error:no data directory"
  17. exit 0
  18. fi
  19. if [ ! -d $INIFILEDIR ] ; then
  20. echo "Error:invalid data directory"
  21. exit 0
  22. else
  23. OPTION="-fss-config=$INIFILEDIR"
  24. fi
  25. if [ ! -d $LOG ] ; then
  26. mkdir $LOG
  27. fi
  28. if [ -f $HOME/$pid ] ; then
  29. echo "pid file exists. unable to start."
  30. else
  31. $EXEFILE $OPTION >> $LOGFILE 2>&1 &
  32. echo $!>$HOME/pid
  33. echo "started"
  34. fi