Без опису

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2015 OpenWrt.org
  3. START=90
  4. STOP=10
  5. USE_PROCD=1
  6. PROG=/usr/lib/sysstat/sadc
  7. SYSSTAT_CFG="/etc/sysstat/sysstat"
  8. validate_sysstat_section() {
  9. uci_validate_section sysstat sysstat "${1}" \
  10. 'log_history:uinteger' \
  11. 'compressafter:uinteger' \
  12. 'sadc_options:string' \
  13. 'sa_dir:string' \
  14. 'zip:string' \
  15. 'enabled:string'
  16. }
  17. start_service() {
  18. local log_history compressafter sadc_options sa_dir zip enabled
  19. validate_sysstat_section sysstat || {
  20. echo "validation failed"
  21. return 1
  22. }
  23. [ -d /var/log/sysstat ] || mkdir -p /var/log/sysstat
  24. echo "HISTORY=$log_history" > $SYSSTAT_CFG
  25. echo "COMPRESSAFTER=$compressafter" >> $SYSSTAT_CFG
  26. echo "SADC_OPTIONS=\"$sadc_options\"" >> $SYSSTAT_CFG
  27. echo "SA_DIR=\"$sa_dir\"" >> $SYSSTAT_CFG
  28. echo "ZIP=\"$zip\"" >> $SYSSTAT_CFG
  29. echo "ENABLED=\"$enabled\"" >> $SYSSTAT_CFG
  30. procd_open_instance
  31. procd_set_param command $PROG -S DISK -F -L -
  32. procd_set_param file $SYSSTAT_CFG
  33. procd_close_instance
  34. }
  35. service_triggers()
  36. {
  37. procd_add_reload_trigger "sysstat"
  38. procd_add_validation validate_sysstat_section
  39. }