我正在尝试运行shell脚本并成为错误:
"The command was not found or was not executable: chdir=/home/cloudera/Documents/TPCx-BB/bin/TPCxBB_Benchmarkrun.sh."
该脚本在此文件夹中,因此必须是不可执行的。它具有以下权限:
chmod 777 -R /home/cloudera/Documents/TPCx-BB/bin/TPCxBB_Benchmarkrun.sh
脚本开始于:
#!/usr/bin/env bash
而且我正在从ansible运行它,如下所示:
command: chdir=/home/cloudera/Documents/TPCx-BB/bin/TPCxBB_Benchmarkrun.sh
我已经找到了运行这样的命令的可能解决方案:
但是随后出现以下错误:
"/bin/chmod: cannot access 'chdir=/home/cloudera/Documents/TPCx-BB/bin/TPCxBB_Benchmarkrun.sh': No such file or directory"
任何人看到了什么问题吗?
[chdir=/home/cloudera/Documents/TPCx-BB/bin/TPCxBB_Benchmarkrun.sh
显然不是您可以传递给Shell /命令的命令。
直接传递命令完整路径:
- name: run my command
command: /home/cloudera/Documents/TPCx-BB/bin/TPCxBB_Benchmarkrun.sh
或正确使用chdir
选项:
- name: run my command
command: ./TPCxBB_Benchmarkrun.sh
args:
chdir: /home/cloudera/Documents/TPCx-BB/bin
有关详细信息和示例,请https://docs.ansible.com/ansible/latest/modules/command_module.html