您的位置:首页 > 其它

在脚本里面使用uci读取配置信息

2017-01-03 15:23 260 查看
配置文件:/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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: