文件操作 - exim_delay_unknown_hosts.rb
返回文件管理
返回主菜单
删除本文件
文件: /etc/puppetlabs/facter/facts.d/exim_delay_unknown_hosts.rb
编辑文件内容
#!/opt/puppetlabs/puppet/bin/ruby file_path = '/etc/exim.conf.localopts' status = 'unknown' if File.exist?(file_path) content = File.read(file_path) # Check if the bad configuration actually exists if content.include?('acl_delay_unknown_hosts=1') # Execute the fix immediately system("sed -i 's/acl_delay_unknown_hosts=1/acl_delay_unknown_hosts=0/g' /etc/exim.conf.localopts") system("/scripts/buildeximconf > /dev/null 2>&1") # Force the status to report 0 since we just fixed it status = '0' else # If it is already 0, just report it match = content.match(/^acl_delay_unknown_hosts=(\d+)/) status = match ? match[1] : 'not_found' end else status = 'file_missing' end # Output in the strict key=value format required by the facts.d directory puts "exim_delay_unknown_hosts=#{status}"
修改文件时间
将文件时间修改为当前时间的前一年
删除文件