-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

相关推荐
测试开发Kevin1 小时前
详解Jenkins 的 Declarative Pipeline中post 语法
jenkins·devops
一张假钞1 天前
Jenkins 项目迁移
ci/cd·jenkins
vortex51 天前
Shell脚本技巧:去除文件中字符串两端空白
linux·bash·shell·sed·awk
软件测试君1 天前
Jenkins Share Library教程 —— 开发入门
jenkins
Broken Arrows2 天前
如何在Linux服务器上部署jenkins?
linux·jenkins
19岁开始学习2 天前
PHP操作elasticsearch7.8
elasticsearch·jenkins·php
wearegogog1232 天前
Centos7下docker的jenkins下载并配置jdk与maven
java·docker·jenkins
gb42152873 天前
elasticsearch索引多长时间刷新一次(智能刷新索引根据数据条数去更新)
大数据·elasticsearch·jenkins
故事很腻i3 天前
安装elk
运维·elk·jenkins
小醉你真好4 天前
15、Docker Compose 安装ELK + Filebeat单机版
elk·docker·jenkins