我使用以下命令从 S3 Bucket 下载了一个 .sh 文件
/usr/local/bin/aws s3 cp s3://mm-s3-encrypt/AppD.sh /prod/msp/domains/dynamicapp_domains/
我确实在路上看到了它,
我做了一个
chmod u+x AppD.sh
然后 ,
复制代码
其结果
: [No such file or directory]omains/dynamicapp_domains/
: [No such file or directory]omains/dynamicapp_domains/msp_dynamicapp_tomcat_01/bin
cp: cannot stat `startup.sh': No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
--2015-10-28 11:32:24-- https://nexus.kdc.capitalone.com/mother/service/local/repositories/WildWildWest/content/com/AppD_AppAgent/4.1.4.3/AppD_AppAgent-4.1.4.3-AppAgent.zip%0D
Resolving nexus.kdc.capitalone.com... 10.42.17.183
Connecting to nexus.kdc.capitalone.com|10.42.17.183|:443... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authorization failed.
但这些命令单独运行正常,这里是脚本
#!/bin/bash
cd /prod/msp/domains/dynamicapp_domains/.
mkdir -p /AppDynamic/AppAgent
mkdir -p /AppDynamic/MachineAgent
cd /prod/msp/domains/dynamicapp_domains/msp_dynamicapp_tomcat_01/bin/.
cp startup.sh startup.sh_orig
HOST=$(hostname)
sed -i '7iexport
> CATALINA_OPTS="$CATALINA_OPTS-javaagent:/prod/msp/domains/dynamicapp_domains/AppDynamic/AppAgent/ver4.1.4.3/javaagent.jar"'
> startup.sh sed -i '10iENABLE_AppD_PROBE="YES";' startup.sh
sed -i.bak -e '15,16d' startup.sh
sed -i '15iif \[ ! -z \${ENABLE_AppD_PROBE\} \]; then' startup.sh
sed -i '16iPROBE_OPTS="-javaagent:/prod/msp/domains/dynamicapp_domains/AppDynamic/AppAgent/ver4.1.4.3/javaagent.jar -Dprobe.id='"$HOST"'_msp_dynamicapp_tomcat_01 -Dprobe.group='"$HOST"'";' startup.sh
cd /prod/msp/domains/dynamicapp_domains/AppDynamic/AppAgent/.
wget https://nexus.kdc.capitalone.com/mother/service/local/repositories/WildWildWest/content/com/AppD_AppAgent/4.1.4.3/AppD_AppAgent-4.1.4.3-AppAgent.zip
答案1
您使用 Windows 文本编辑器 (如果你珍惜自己的理智,就永远不要这样做),因此每行末尾都有回车符。类 UNIX 操作系统不会对这些进行特殊处理。
要修复该文件,请运行dos2unix
它。
dos2unix AppD.sh