Wait until tomcat finishes starting up

前端 未结 8 2194
囚心锁ツ
囚心锁ツ 2020-12-24 13:29

I have a script that needs to run after tomcat has finished starting up and is ready to start deploying applications. I\'m using $TOMCAT_HOME/bin/startup.sh whi

8条回答
  •  死守一世寂寞
    2020-12-24 13:56

    I have done it with the following code in jenkins pipelinescript with tomcat. Before i just call

    sudo /bin/systemctl restart tomcat
    

    And have an entry in my sudoers file for the jenkins user.

    Now here is the oneliner:

    until [ "$(curl -w '%{response_code}' --no-keepalive -o /dev/null --connect-timeout 1 -u USERNAME:PASSWORD http://localhost:8080/manager/text/list)" == "200" ]; do echo --- sleeping for 1 second; sleep 1; done
    

    Better readable:

    until [ "$(curl -w '%{response_code}' --no-keepalive -o /dev/null --connect-timeout 1 -u USERNAME:PASSWORD http://localhost:8080/manager/text/list)" == "200" ];
    do echo --- sleeping for 1 second;
    sleep 1;
    done
    

提交回复
热议问题