3.shell 执行脚本安装二次开发后的Apache Dolphinscheduler时报‘$\r’ command not found

一、问题

运行二次开发后的Apache Dolphinscheduler安装脚本时报‘\r’ command not fand

执行命令

sh install.sh

已经安装好了就没必要去重现了,报错日志类似下图
在这里插入图片描述

二、解决

1.思路

\r\n是windows下默认的换行符
\n是linux下默认的换行符
看报错应该是和文件格式有关的问题
打开一个报错中出现的文件,查看格式

vim start-all.sh
:set ff

发现果然是dos

2、解决

下载dos2unix

yum -y install dos2unix

执行dos2unix 将脚本和配置文件的格式都转换成unix格式

cd $DOLPHINSCHEDULER_HOME/conf
[username@hostname conf]# dos2unix ./*
dos2unix: converting file ./alert.properties to Unix format ...
dos2unix: converting file ./application-api.properties to Unix format ...
dos2unix: converting file ./common.properties to Unix format ...
dos2unix: Skipping ./config, not a regular file.
dos2unix: converting file ./datasource.properties to Unix format ...
dos2unix: Skipping ./env, not a regular file.
dos2unix: Skipping ./i18n, not a regular file.
dos2unix: converting file ./logback-alert.xml to Unix format ...
dos2unix: converting file ./logback-api.xml to Unix format ...
dos2unix: converting file ./logback-master.xml to Unix format ...
dos2unix: converting file ./logback-worker.xml to Unix format ...
dos2unix: converting file ./master.properties to Unix format ...
dos2unix: Skipping ./org, not a regular file.
dos2unix: converting file ./quartz.properties to Unix format ...
dos2unix: converting file ./worker.properties to Unix format ...
dos2unix: converting file ./zookeeper.properties to Unix format ...

cd $DOLPHINSCHEDULER_HOME/bin
[username@hostname conf]# dos2unix ./*

此时conf和bin下的所有文件都已经变为unix
打开一个检查一下

vi $DOLPHINSCHEDULER_HOME/conf/common.properties
:set ff 

发现已经是unix了

猜你喜欢

转载自blog.csdn.net/qq_39945938/article/details/108321497