【发布时间】:2021-03-03 15:11:12
【问题描述】:
我有 hieradata yaml 文件,其中包含很多选项和一些 cronjobs 我想再添加一个 cronjob,其中包含多个带引号的 bash 命令:
hbase_test:
cron: '*/5 * * * *'
user: 'root'
command: '(date && echo "describe \'my_table\'; exit" | hbase shell) >> hbase_test.log 2>&1;'
flock: true
但这不起作用 - puppet 无法加载此类 yaml。 我也尝试了下一个方法:
command: "(date && echo \"describe 'my_table'; exit\" | hbase shell) >> hbase_test.log 2>&1;"
Puppet 没问题,hbase 启动成功,但是失败:
describe my_table; exit
NameError: undefined local variable or method `my_table' for #<Object:0xf9f041c>
正确的命令必须是:
describe 'my_table'; exit
我失去了报价!而且我不知道如何以正确的方式逃脱它们。 我也试过了
command:>
(date && echo "describe 'my_table'; exit" | hbase shell) >> hbase_test.log 2>&1;
但是 cron 没有启动。
【问题讨论】:
标签: bash yaml puppet quotes hiera