Jenkins executes the command script and prompts that the command cannot be found

Phenomenon : The output of the script executed in the Jenkins command cannot find the command, and it can be executed by logging in to the host manually.

Reason and solution : By default, Jenkins executes shell scripts using non-login mode, but the non-login mode does not load the /etc/profile file. Add the #!/bin/bash -l  command to the Execute shell and  modify it to login mode. To solve the problem, the -l parameter is very important.

 

Guess you like

Origin blog.csdn.net/qq_36961530/article/details/112318974