periodicstatsd : Changes for periodic statistics.

- missing library files under /usr/lib/bbfdm
	- Added global enable for periodicstats & disabled by default
	- updated to latest devel
This commit is contained in:
Shubham Sharma 2021-02-26 15:53:06 +05:30 committed by Shubham
parent 7a3dee480e
commit a8bd624873
3 changed files with 98 additions and 0 deletions

52
periodicstats/Makefile Normal file
View file

@ -0,0 +1,52 @@
#
# Copyright (C) 2020 IOPSYS
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=periodicstats
PKG_VERSION:=1.0.0
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=91b15f9779baccc93213ce3ca164c326235d3096
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/periodicstats.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
endif
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/periodicstats
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Periodic Statistics Daemon
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm
endef
define Package/periodicstats/description
Manage periodic statistics
endef
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
$(CP) -rf ./periodicstats/* $(PKG_BUILD_DIR)/
endef
endif
define Package/periodicstats/install
$(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/usr
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
$(CP) $(PKG_BUILD_DIR)/bbf_plugin/libperiodicstats.so $(1)/usr/lib/bbfdm
$(INSTALL_BIN) $(PKG_BUILD_DIR)/periodicstatsd $(1)/usr/sbin
endef
$(eval $(call BuildPackage,periodicstats))

View file

@ -0,0 +1,3 @@
config globals 'globals'
option enable '0'

View file

@ -0,0 +1,43 @@
#!/bin/sh /etc/rc.common
START=99
STOP=10
USE_PROCD=1
NAME=periodicstatsd
PROG=/usr/sbin/periodicstatsd
. /lib/functions.sh
start_service() {
if [ -f "/etc/config/periodicstats" ]; then
if [ "$(uci -q get periodicstats.globals.enable)" == "1" ]; then
procd_open_instance periodicstatsd
procd_set_param command ${PROG}
procd_set_param respawn
procd_close_instance
fi
fi
}
stop() {
#stop_service() is called after procd killed the service
echo ;
}
boot() {
start
}
service_triggers() {
procd_add_reload_trigger periodicstats
}
reload_service() {
stop
start
}
restart() {
start
}