diff options
author | Jeffery To <jeffery.to@gmail.com> | 2019-02-12 14:57:40 +0800 |
---|---|---|
committer | Jeffery To <jeffery.to@gmail.com> | 2019-02-12 14:57:40 +0800 |
commit | 1b48b88c9535155342742917f5acd3cf226a0846 (patch) | |
tree | ecf68033169e1b84804fbcc39dde9ec593a77ff0 /utils/sysstat | |
parent | f9b16dea51b34e6fbced77a81096cf1fb82f39ce (diff) |
sysstat: Update init script
This replaces the use of uci_validate_section() with
uci_load_validate(), which removes the need to declare local variables
for every config option.
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
Diffstat (limited to 'utils/sysstat')
-rw-r--r-- | utils/sysstat/Makefile | 2 | ||||
-rwxr-xr-x | utils/sysstat/files/sysstat.init | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/utils/sysstat/Makefile b/utils/sysstat/Makefile index a7278a03e..45e5529ba 100644 --- a/utils/sysstat/Makefile +++ b/utils/sysstat/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sysstat PKG_VERSION:=12.0.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr> diff --git a/utils/sysstat/files/sysstat.init b/utils/sysstat/files/sysstat.init index a8190008d..9975d5ea6 100755 --- a/utils/sysstat/files/sysstat.init +++ b/utils/sysstat/files/sysstat.init @@ -9,7 +9,7 @@ PROG=/usr/lib/sysstat/sadc SYSSTAT_CFG="/etc/sysstat/sysstat" validate_sysstat_section() { - uci_validate_section sysstat sysstat "${1}" \ + uci_load_validate sysstat sysstat "$1" "$2" \ 'log_history:uinteger' \ 'compressafter:uinteger' \ 'sadc_options:string' \ @@ -18,11 +18,8 @@ validate_sysstat_section() { 'enabled:string' } -start_service() { - - local log_history compressafter sadc_options sa_dir zip enabled - - validate_sysstat_section sysstat || { +start_sysstat_instance() { + [ "$2" = 0 ] || { echo "validation failed" return 1 } @@ -42,6 +39,10 @@ start_service() { procd_close_instance } +start_service() { + validate_sysstat_section sysstat start_sysstat_instance +} + service_triggers() { procd_add_reload_trigger "sysstat" |