Skip to content

Instantly share code, notes, and snippets.

cfg_parser() {
IFS=$'\n' && ini=( $(<$1) ) # convert to line-array
ini=( ${ini[*]//;*/} ) # remove comments ;
ini=( ${ini[*]//\#*/} ) # remove comments #
ini=( ${ini[*]/#[/\}$'\n'cfg.section.} ) # set section prefix
ini=( ${ini[*]/%]/ \(} ) # convert text2function (1)
ini=( ${ini[*]/=/=\( } ) # convert item to array
ini=( ${ini[*]/%/ \)} ) # close array parenthesis
ini=( ${ini[*]/%\( \)/\(\) \{} ) # convert text2function (2)
ini=( ${ini[*]/%\} \)/\}} ) # remove extra parenthesis
task :synctopbuilder do
tmp_freedhcp_index="tmp/freedhcp-server-index"
rm_rf freedhcpsrc + '/' + tmp_freedhcp_index
sh "git --work-tree=#{freedhcpsrc} --git-dir=#{freedhcpsrc}/.git " +
"checkout-index -a -f --prefix=#{tmp_freedhcp_index}/"
sh "rsync --delete -r #{freedhcpsrc}/#{tmp_freedhcp_index} #{srcforpbuilder}"
end
while true
do
tput clear
date
/usr/local/icinga/bin/icinga -v /etc/nagios3/icinga.cfg | grep -B 10 'Total Errors:'
sleep 30
done