場(chǎng)景: Jenkins 遠(yuǎn)程部署 Java工程.
異常: 文件已正常遠(yuǎn)程傳輸?shù)竭h(yuǎn)端服務(wù)器, 在最后執(zhí)行運(yùn)行腳本時(shí), 出現(xiàn)標(biāo)題的異常.
排查: 該腳本是正常的, 在遠(yuǎn)程服務(wù)器已經(jīng)正常測(cè)試過了, 是root權(quán)限, 現(xiàn)在用Jenkins也是root權(quán)限, 怎么看都不會(huì)出現(xiàn)問題才對(duì).
- 實(shí)際的經(jīng)過可以用下面這段英文來描述:
How it happened: When I was using Jenkins to remotely deploy a Java project, I could not find the Java command. I was executing a Shell script. The reason was that I could not read the user's environment variable when executing a Shell command remotely. To use environment variables, you need to re-execute the 'source /etc/profile' command before invoking the Java command in the script.
用英文翻譯一下, 加深印象, 以前遇到過類似的問題, 所以看到報(bào)錯(cuò)信息, 很快解決了, 也給沒遇到過類似情況的小伙伴一個(gè)提醒.