配置文件:/etc/config/cdn
config cdnclient 'main'
option host '127.0.0.1'
option port '31200'
option frequency '5'
脚本命令
start_instance () {
local cfg="$1"
config_get _host "$cfg" host
config_get _port "$cfg" port
config_get _frequency "$cfg" frequency
echo "cfg is $cfg"
echo "host is $_host"
echo "port is $_port"
echo "frequency is $_frequency"
}
config_load cdn
config_foreach start_instance cdnclient
执行结果
cfg is main
host is 127.0.0.1
port is 31200
frequency is 5