start-server.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # <<
  3. # Davinci
  4. # ==
  5. # Copyright (C) 2016 - 2019 EDP
  6. # ==
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # >>
  17. #start server
  18. if [ -z "$DAVINCI3_HOME" ]; then
  19. echo "DAVINCI3_HOME not found"
  20. echo "Please export DAVINCI3_HOME to your environment variable"
  21. exit
  22. fi
  23. cd $DAVINCI3_HOME
  24. Lib_dir=`ls | grep lib`
  25. if [ -z "$Lib_dir" ]; then
  26. echo "Invalid DAVINCI3_HOME"
  27. exit
  28. fi
  29. Server=`ps -ef | grep java | grep edp.DavinciServerApplication | grep -v grep | awk '{print $2}'`
  30. if [[ $Server -gt 0 ]]; then
  31. echo "[Davinci Server] is already started"
  32. exit
  33. fi
  34. cd $DAVINCI3_HOME
  35. TODAY=`date "+%Y-%m-%d"`
  36. LOG_PATH=$DAVINCI3_HOME/logs/sys/davinci.$TODAY.log
  37. nohup java -Dfile.encoding=UTF-8 -cp $JAVA_HOME/lib/*:lib/* edp.DavinciServerApplication > $LOG_PATH 2>&1 &
  38. echo "=========================================="
  39. echo "Starting..., press \`CRTL + C\` to exit log"
  40. echo "=========================================="
  41. sleep 3s
  42. tail -f $LOG_PATH