-bash: ./deploy.sh: /bin/bash^M: bad interpreter: No such file or directory

文章目录

场景

jenkins 发布失败, 报错ERROR: Exception when publishing, exception message Exec exit status not zero. Status \[126], 这说明远程服务器的deploy.sh执行失败, 首先检查权限,没有发现问题,然后手动执行一遍又报错"-bash: ./deploy.sh: /bin/bash^M: bad interpreter: No such file or directory", 这个意味着脚本是windows回车符结尾

txt 复制代码
[JENKINS] Archiving /home/vagrant/.jenkins/workspace/jenkinsDemo/target/jenkinsDemo-1.0-SNAPSHOT.jar to com.carsonlius/jenkinsDemo/1.0-SNAPSHOT/jenkinsDemo-1.0-SNAPSHOT.jar
channel stopped
SSH: Connecting from host [ubuntu-xenial]
SSH: Connecting with configuration [107.173.111.224 自己] ...
SSH: EXEC: completed after 604 ms
SSH: Disconnecting configuration [107.173.111.224 自己] ...
ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [126]]
Build step 'Send build artifacts over SSH' changed build result to UNSTABLE

解决

sed -i -e 's/\r$//' deploy.sh

相关推荐
Shell运维手记21 小时前
Linux (挂载|rpm|yum|源码编译)
linux·运维·笔记·网络协议·bash
杨充2 天前
05.多用组合和少继承
开发语言·bash
暖核2 天前
Linux实战入门:从零编写第一个Bash Shell脚本
linux·运维·bash
lisanmengmeng2 天前
搭建elk环境并接入frostmourne,实现监控报警效果(一)
运维·elk·jenkins
happy_baymax2 天前
多FTP同目录文件下载脚本
bash
爱编程的Zion4 天前
Jenkins 从 0 到 1 学习笔记
笔记·学习·jenkins
JavaDog程序狗5 天前
【指南】uni-app微信小程序多环境CI-CD完全指南
ci/cd·uni-app·jenkins
柒号华仔6 天前
「速通Shell」聚砖成墙,Shell函数封装之道
linux·ssh·bash
heimeiyingwang7 天前
【GitOps·入门篇】工具生态:ArgoCD、Flux、Jenkins X 对比选型
jenkins·flux·argocd·gitops
骇客野人7 天前
基于Nginx+Eureka+Apollo+Jenkins+SpringBoot Web系统分布式部署方案
nginx·eureka·jenkins