35 lines
755 B
Plaintext
35 lines
755 B
Plaintext
|
#!/bin/sh /etc/rc.common
|
||
|
# Copyright (C) 2014 OpenWrt.org
|
||
|
|
||
|
NAME=wifi-sentinel
|
||
|
START=95
|
||
|
|
||
|
SENTINEL_BIN=/usr/bin/${NAME}.sh
|
||
|
|
||
|
USE_PROCD=1
|
||
|
|
||
|
start_instance() {
|
||
|
local cfg="$1"
|
||
|
local packets interval network
|
||
|
|
||
|
config_get packets "$cfg" "packets"
|
||
|
config_get interval "$cfg" "interval"
|
||
|
config_get network "$cfg" "network"
|
||
|
|
||
|
procd_open_instance
|
||
|
|
||
|
procd_set_param command "${SENTINEL_BIN}"
|
||
|
procd_set_param respawn
|
||
|
procd_set_param env PACKETS=$packets INTERVAL=$interval NETWORK=$network
|
||
|
|
||
|
procd_add_reload_interface_trigger $interface
|
||
|
procd_add_reload_trigger "${NAME}"
|
||
|
|
||
|
procd_close_instance
|
||
|
}
|
||
|
|
||
|
start_service() {
|
||
|
config_load ${NAME}
|
||
|
config_foreach start_instance ${NAME}
|
||
|
}
|