我正在尝试对某些节点使用chef搜索:
hosts = search(:node, 'chef_environment:STG AND role:elasticsearch')
Chef::Log.warn("Hosts are #{hosts}")
hosts.each do |node|
Chef::Log.warn("hostname is: #{node['name']} and has the following tags #{node["tags"]}")
end
第一个Chef::Log.warn
我从代码点火器开始,我在DB查询方面遇到了麻烦。如果我以标准PHP代码运行查询,它将显示查询中传递的所有数据,但如果我使用codeigniter运行查询,则它只显示一行,其中包含一个foreach。
模型中的:
$query = $this->db->query('select C.display_name AS "Servicio", B.output AS "Status", B.last_time_ok AS "Ultimo OK" , B.last_time_critical AS "Ultimo C
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: files systemd
group:
我在脚本中使用下面的代码,它应该匹配hosts.test中的"title随机Linux服务器“,并在2行匹配字符串之后将t3文件的文本插入到hosts.test中。但它带来了一些错误。
sed -i.bak '/^title AHS - zarriot CBTS random Linux Servers$/ {N;N; r t3}' hosts.test
有人能帮我吗?
如何在一个命令行中运行对应的sed命令?
sed -i s'/12.1.0.11/#12.1.0.11/g' /etc/hosts
sed -i s'/12.1.0.12/#12.1.0.12/g' /etc/hosts
sed -i s'/12.1.0.21/#12.1.0.21/g' /etc/hosts
sed -i s'/12.1.0.22/#12.1.0.22/g' /etc/hosts
我的目标是通过ssh更新目标主机文件。
我不想跑4次!
示例
ssh linux1 sed -i s'/12
我在.sh文件中定义了一个数组,如下所示:
hosts=(NODE IPS)
hosts[0]="1.110,Node-01"
hosts[1]="1.111,Node-02"
hosts[2]="1.112,Node-03"
hosts[3]="1.113,Node-04"
hosts[4]="1.114,Node-05"
hosts[5]="1.115,Node-06"
如何循环数组,但根据逗号拆分每个索引,并将值存储在变量中,如下所示:
for index in ${!hosts[*]}
do