scenario: use jenkins to deploy the springboot project and execute the shell script java-jar
question: after the jenkins console successfully executes the mvn build and uploads the jar to the remote server, And execute
java-jar cms-web-0.0.1-SNAPSHOT.jar-- spring.profiles.active=prod > / dev/null 2 > & 1 &
explain why the java-jar log is not printed on the jenkins console: because the ssh of jenkins has a timeout of 300000 (Timeout in milliseconds for the SSH connections.), if you execute the log output of java-jar, it will cause Jenkins to time out. As a result, jenkins thinks that the deployment failed
, which will lead to what I want to optimize now: there is no log. No matter what the execution result of java-jar is, I will echo a message of success in its backend echo. In this way, the log of java-jar execution can not be seen in the jenkins console, nor can I know whether the java-jar execution is successful or not. After each release, I find that I can"t connect to the backend, so I can only check the log, which is very troublesome. If you have any good solutions, I don"t have much experience. Please advise
the following figure is the key shell script snippet: