heartbeat-app.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #/bin/sh
  2. post_json() {
  3. response=`curl "${address}${url}" -X $request --connect-timeout 15 -m 20 --header 'Content-Type: application/json' -d "${data}" -o /dev/null -s -w %{http_code}`
  4. if [ $response != '200' ];then
  5. exit 3
  6. fi
  7. }
  8. post_jsonstring() {
  9. response=`curl "${address}${url}" -X $request --connect-timeout 15 -m 20 --header 'Content-Type: application/x-www-form-urlencoded' -d "jsonSting=${data}" -o /dev/null -s -w %{http_code}`
  10. if [ $response != '200' ];then
  11. exit 3
  12. fi
  13. }
  14. if [ -n "$SERVER_PORT" ];then
  15. port="$SERVER_PORT"
  16. elif [ -n "$PORT_DOCKER" ];then
  17. port="$PORT_DOCKER"
  18. fi
  19. address="http://127.0.0.1:${port}"
  20. request='POST'
  21. type='json'
  22. url="/reportOutlines/enums/reportState"
  23. data='{}'
  24. # address="http://127.0.0.1:${port}"
  25. # request='POST'
  26. # type='jsonstring'
  27. # url="/Spring/MVC/entrance/unifier/getPersonByUserNameService"
  28. # data='{"user_id":"","pd":"","person_id":"","groupCode":"BR","puser":{"userId":"","loginDevice":"PC","pd":""},"loginName":"PERSAGYADMIN","loginDevice":"PC","isAdminLogin":true}'
  29. if [ "$type" = "json" ];then
  30. post_json
  31. elif [ "$type" = "jsonstring" ];then
  32. post_jsonstring
  33. fi