jenkins报错集锦

  1. jenkins使用publish over ssh执行shell脚本启动java程序无法启动
    jenkins报错集锦_第1张图片报错:

     Started by user admin
     Building in workspace /root/.jenkins/workspace
     SSH: Connecting from host [localhost.38]
     SSH: Connecting with configuration [192.168.1.42] ...
     SSH: EXEC: STDOUT/STDERR from command [sh /opt/run_test.sh] ...
     正在升级 '.':
     版本 22162。
     update code from svn ...
     which: no java in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)
     The JAVA_HOME environment variable is not defined correctly
     This environment variable is needed to run this program
     NB: JAVA_HOME should point to a JDK not a JRE
     stop application
    
     ms-provider-activiti is already stoped
     start application
     start ms-provider-activiti ...
     SSH: EXEC: completed after 400 ms
     SSH: Disconnecting configuration [192.168.1.42] ...
     SSH: Transferred 0 file(s)
     Finished: SUCCESS
    

原因: 执行脚本时候找不到java环境变量

解决方法:

	使用/bin/bash -l 去执行脚本
		-l  表示使用当前登录用户去执行

你可能感兴趣的:(自动化运维工具)