start.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #!/bin/bash
  2. export JAVA_HOME=/root/jdk1.8.0_181
  3. export PATH=$JAVA_HOME/bin:$PATH
  4. export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
  5. bashPath=/root/maxcompute_job/flow
  6. if [ $# -eq 0 ];then
  7. echo "---------------------------------------------------------------------------"
  8. # OS Type
  9. echo " OS Type: $(uname -o)"
  10. # OS Release Version and Name
  11. echo "OS Release Version and Name: $(cat /etc/issue | head -n 1)"
  12. #Architecture
  13. echo " Architecture: $(uname -m)"
  14. #Kernel Release
  15. echo " Kernel Release: $(uname -r)"
  16. #hostname
  17. echo " hostname: $HOSTNAME"
  18. #Internal IP
  19. echo " Internal IP: $(hostname -I)"
  20. #External IP
  21. echo " External IP: $(curl --connect-timeout 10 -m 20 -s ipecho.net/plain)"
  22. #DNS
  23. dnsservers=""
  24. for i in $(cat /etc/resolv.conf | grep '^nameserver' | awk '{print $NF}')
  25. do
  26. dnsservers="$dnsservers$i "
  27. done
  28. echo " DNS: $dnsservers"
  29. #if connected to Internet or not
  30. echo " internet status: $( ping -c 2 www.baidu.com &> /dev/null && echo 'connected' || echo 'disconnected')"
  31. echo "---------------------------------------------------------------------------"
  32. fi
  33. # shellcheck disable=SC2164
  34. cd $bashPath/repo
  35. git pull origin master # 拉取仓库
  36. cd ..
  37. java -jar $bashPath/DataWorks-flow-touch.jar -w
  38. if [ $? -eq 0 ]; then
  39. echo "上游数据已同步完成!"
  40. else
  41. echo "上游数据长时间未同步完成,程序中止!"
  42. exit $?
  43. fi
  44. java -jar $bashPath/DataWorks-flow-touch.jar -q
  45. if [ $? -eq 0 ]; then
  46. echo "company is not empty!"
  47. else
  48. echo "company is empty!"
  49. exit $?
  50. fi
  51. java -jar $bashPath/DataWorks-flow-touch.jar -f $bashPath/jobs/task-step01.yaml
  52. if [ $? -eq 0 ]; then
  53. echo "step01 succeed"
  54. else
  55. echo "step01 failed"
  56. exit $?
  57. fi
  58. java -jar $bashPath/DataWorks-flow-touch.jar -f $bashPath/jobs/task-step02.yaml
  59. if [ $? -eq 0 ]; then
  60. echo "step02 succeed"
  61. else
  62. echo "step02 failed"
  63. exit $?
  64. fi
  65. java -jar $bashPath/DataWorks-flow-touch.jar -f $bashPath/jobs/task-step03.yaml
  66. if [ $? -eq 0 ]; then
  67. echo "step03 succeed"
  68. else
  69. echo "step03 failed"
  70. exit $?
  71. fi
  72. java -jar $bashPath/DataWorks-flow-touch.jar -f $bashPath/jobs/task-step04.yaml
  73. if [ $? -eq 0 ]; then
  74. echo "step04 succeed"
  75. else
  76. echo "step04 failed"
  77. exit $?
  78. fi
  79. echo "end"