如何在Azure池启动任务中运行多条命令?启动任务执行失败求助
Fixing wget Usage Error in Azure Batch Start Task
It looks like your wget command is hitting a quoting/parsing issue in the Azure Batch start task environment—this is a common gotcha when passing multi-argument commands with nested quotes to shell environments. The error you're seeing (Usage: wget [OPTION]... [URL]...) means the shell is splitting your command incorrectly, so wget isn't receiving the parameters it expects.
Here's the corrected command to use:
sudo bash -c 'wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.rpm && yum localinstall jdk-8u161-linux-x64.rpm -y'
Why this works:
- Wrapping the entire command chain in
bash -c ''tells the shell to treat everything inside the single quotes as a single command string. This prevents the outer shell from misinterpreting the nested double quotes in yourCookieheader. - We removed the extra
sudobeforeyum localinstall—since we're already running the entire command undersudo, it's redundant (and can cause unnecessary permission issues in some cases).
Additional checks:
- Verify that the Azure Batch node has internet access to reach Oracle's download server.
- If you still hit issues, add verbose output to wget (
-vflag) to get more detailed logs about what's going wrong:sudo bash -c 'wget -v --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.rpm && yum localinstall jdk-8u161-linux-x64.rpm -y'
内容的提问来源于stack exchange,提问作者Quan Hoang
相关产品推荐
相关产品推荐

