openwrt 相关有用的

2015-10-19 echo 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

标签: openwrt


版权所有: 本文发布于DD'echo
转载请保留原文链接: http://echo.z-dd.net/post-5.html
除非注明,文章均为 echo >> 原创 ,欢迎转载!转载请注明本文地址,谢谢!

友荐云推荐

发表评论:

Copyright @ 2015 DD'echo All rights reserved. Powered by emlog