openwrt 相关有用的
config_load等获取config配置文件:
#!/bin/sh /etc/rc.common
# Copyright (C) 2013 NXP Semiconductor
# -s /dev/ttyTX0 -B 115200 –mode=coordinator -6 fd04:bd3:80e8:10::1 -c 15 -I zb0
START=99
PROG=zigbee-jip-daemon
start_zigbee_jip_daemon() {
local section="$1"
config_get_bool ignore "$section" ignore 0
[ "$ignore" -ne 0 ] && return 0
local tty
config_get tty "${section}" tty
[ -z $tty ] && tty="/dev/ttyUSB0"
local interface
config_get interface "${section}" interface
local baudrate
config_get baudrate "${section}" baudrate
[ -z $baudrate ] && baudrate="1000000"
local mode
config_get mode "${section}" mode
local borderrouter
config_get borderrouter "${section}" borderrouter
local channel
config_get channel "${section}" channel
local whitelisting
config_get whitelisting "${section}" whitelisting
local args
args="-s $tty -B $baudrate --mode=$mode -6 $borderrouter -c $channel"
if [ $interface ]
then
args="$args -I $interface"
fi
if [ $whitelisting -ne 0 ]
then
args="$args --whitelisting"
fi
echo "Starting $PROG with arguments: $args"
/usr/sbin/$PROG $args
}
start () {
config_load zigbee-jip-daemon
config_foreach start_zigbee_jip_daemon zigbee-jip-daemon
}
stop () {
killall $PROG
}
log操作:
logread
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 DD'Notes!
评论