mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
loop-detector: hook it up to openwrt init and uci structure
This commit is contained in:
parent
541715b927
commit
991927899d
3 changed files with 46 additions and 3 deletions
|
|
@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk
|
|||
PKG_NAME:=loop-detector
|
||||
PKG_VERSION:=1.0
|
||||
|
||||
PKG_SOURCE_VERSION:=2e8584ae8a6d2e089f7a6db7628b218792a35c99
|
||||
PKG_SOURCE_VERSION:=c2c4b1de3315fe7b04460b57351b9ee9d3163bd7
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/loop-detector
|
||||
|
||||
|
|
@ -39,8 +39,10 @@ CONFIGURE_ARGS += \
|
|||
define Package/loop-detector/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/loop-detector $(1)/sbin/
|
||||
#$(INSTALL_DIR) $(1)/etc/config
|
||||
#$(CP) $(PKG_BUILD_DIR)/config/loopDetect $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(CP) ./files/loop_detection.init $(1)/etc/init.d/loop_detection
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(CP) ./files/loop_detection.config $(1)/etc/config/loop_detection
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,loop-detector))
|
||||
|
|
|
|||
5
loop-detector/files/loop_detection.config
Normal file
5
loop-detector/files/loop_detection.config
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
config loop-detect loop
|
||||
option enabled '1'
|
||||
option discovery_interval '10'
|
||||
option recovery_check_tries '5'
|
||||
|
||||
36
loop-detector/files/loop_detection.init
Executable file
36
loop-detector/files/loop_detection.init
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=21
|
||||
STOP=89
|
||||
|
||||
USE_PROCD=1
|
||||
NAME=loop-detector
|
||||
|
||||
start_service() {
|
||||
local enabled
|
||||
|
||||
config_load loop_detection
|
||||
config_get_bool enabled loop enabled 1
|
||||
|
||||
if [ $enabled -eq 1 ]; then
|
||||
procd_open_instance
|
||||
procd_set_param command "/sbin/loop-detector"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /sbin/loop-detector
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger loop-detect
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
Loading…
Add table
Reference in a new issue