关闭

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

249人阅读 评论(0) 收藏 举报
分类:

配置文件:/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


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:19245次
    • 积分:518
    • 等级:
    • 排名:千里之外
    • 原创:33篇
    • 转载:3篇
    • 译文:0篇
    • 评论:0条