Dubbo服务Jar 包启动失败,sed: cant read xxxxxx : No such file or directory command not found

Jekens 自动部署 Dubbo 服务时。shell 脚本执行异常。。。

由于每个服务的 Jar 包,是在开发人员的 windows 系统上生成的,包括里面的 shell 脚本。

Dubbo服务Jar 包启动失败,sed: cant read xxxxxx : No such file or directory command not found_第1张图片

所以,jar 包放在linux 上执行时,shell脚本执行失败。如下图:

Dubbo服务Jar 包启动失败,sed: cant read xxxxxx : No such file or directory command not found_第2张图片

但是,实际上,配置文件是存在于目录的,Dubbo服务Jar 包启动失败,sed: cant read xxxxxx : No such file or directory command not found_第3张图片

造成此现象的原因是由于上文提到的, shell 脚本 在windows 上编译的,运行时是在linux 运行的,脚本的内容已经发生了改变。解决办法如下:

1.编辑 shell 脚本:

#vim  start.sh

2.查看脚本格式:

:set ff

Dubbo服务Jar 包启动失败,sed: cant read xxxxxx : No such file or directory command not found_第4张图片

可以看到,格式是  dos  版本的,这种格式是 linux 不支持的,需要改成 unix 版本。

3.修改格式:

:set ff=unix

Dubbo服务Jar 包启动失败,sed: cant read xxxxxx : No such file or directory command not found_第5张图片

查看更改后的格式,已经是unix 了。Dubbo服务Jar 包启动失败,sed: cant read xxxxxx : No such file or directory command not found_第6张图片

4.保存并推出编辑:

:wq

Dubbo服务Jar 包启动失败,sed: cant read xxxxxx : No such file or directory command not found_第7张图片

5.再次启动,即可成功:

Dubbo服务Jar 包启动失败,sed: cant read xxxxxx : No such file or directory command not found_第8张图片

你可能感兴趣的:(centos,dubbo,运维)