Shell脚本Jenkins 401错误
我试图在Jenkins中运行一个脚本,以了解我们的登台服务器的状态,因此当在CLI中执行时,该脚本可以完美地工作 脚本如下:Shell脚本Jenkins 401错误,jenkins,Jenkins,我试图在Jenkins中运行一个脚本,以了解我们的登台服务器的状态,因此当在CLI中执行时,该脚本可以完美地工作 脚本如下: #!/bin/bash hostlist=(s-exe1.cv.us s-exe2.cv.us s-exe3.cv.us s-exe4.cv.us) for host in "${hostlist[@]}"; do status=$(curl -sLI -o /dev/null -w "%{http_code}" "$host") case "
#!/bin/bash
hostlist=(s-exe1.cv.us s-exe2.cv.us s-exe3.cv.us s-exe4.cv.us)
for host in "${hostlist[@]}"; do
status=$(curl -sLI -o /dev/null -w "%{http_code}" "$host")
case "$status" in
200) echo "INFO: ssh on $host responding [Looks Good]" ;;
*) echo "ERROR: $host responded with $status"[ Ooops Something Went
Wrong] ;;
esac
printf "%s\n" "$status"
done
Started by timer
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/Staging-Server-Status
[Staging-Server-Status] $ /bin/bash /tmp/hudson3637650861266439787.sh
ERROR: s-exe1.cv.us responded with 401[ Ooops Something Went Wrong]
401
ERROR: s-exe2.cv.us responded with 401[ Ooops Something Went Wrong]
401
ERROR: s-exe3.cv.us responded with 401[ Ooops Something Went Wrong]
401
ERROR: s-exe4.cv.us responded with 401[ Ooops Something Went Wrong]
401
Finished: SUCCESS
但当我在Jenkins中构建项目时,我得到如下错误:
#!/bin/bash
hostlist=(s-exe1.cv.us s-exe2.cv.us s-exe3.cv.us s-exe4.cv.us)
for host in "${hostlist[@]}"; do
status=$(curl -sLI -o /dev/null -w "%{http_code}" "$host")
case "$status" in
200) echo "INFO: ssh on $host responding [Looks Good]" ;;
*) echo "ERROR: $host responded with $status"[ Ooops Something Went
Wrong] ;;
esac
printf "%s\n" "$status"
done
Started by timer
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/Staging-Server-Status
[Staging-Server-Status] $ /bin/bash /tmp/hudson3637650861266439787.sh
ERROR: s-exe1.cv.us responded with 401[ Ooops Something Went Wrong]
401
ERROR: s-exe2.cv.us responded with 401[ Ooops Something Went Wrong]
401
ERROR: s-exe3.cv.us responded with 401[ Ooops Something Went Wrong]
401
ERROR: s-exe4.cv.us responded with 401[ Ooops Something Went Wrong]
401
Finished: SUCCESS
有人能帮我解决Jenkins中的401错误吗?我猜运行CLI脚本的用户和运行Jenkins构建的用户不一样,是吗?不一样!那就是我!我会使用一些程序选项来收集更多数据。支持冗余切换,以及将标准输出/标准输出写入文件。出于测试目的,我只在主机列表中使用一台主机。我猜运行CLI脚本的用户和运行Jenkins构建的用户不一样,是吗?不一样!那就是我!我会使用一些程序选项来收集更多数据。支持冗余切换,以及将标准输出/标准输出写入文件。出于测试目的,我只在
hostlist
中使用一台主机。