netdata.in 815 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-3.0-or-later
  3. . /etc/rc.subr
  4. name=netdata
  5. rcvar=netdata_enable
  6. piddir="@localstatedir_POST@/run/netdata"
  7. pidfile="${piddir}/netdata.pid"
  8. command="@sbindir_POST@/netdata"
  9. command_args="-P ${pidfile}"
  10. required_files="@configdir_POST@/netdata.conf"
  11. start_precmd="netdata_prestart"
  12. stop_postcmd="netdata_poststop"
  13. extra_commands="reloadhealth"
  14. reloadhealth_cmd="netdata_reloadhealth"
  15. netdata_prestart()
  16. {
  17. [ ! -d "${piddir}" ] && mkdir -p "${piddir}"
  18. chown @netdata_user_POST@:@netdata_user_POST@ "${piddir}"
  19. return 0
  20. }
  21. netdata_poststop()
  22. {
  23. [ -f "${pidfile}" ] && rm "${pidfile}"
  24. return 0
  25. }
  26. netdata_reloadhealth()
  27. {
  28. p=`cat ${pidfile}`
  29. kill -USR2 ${p} && echo "Sent USR2 (reload health) to pid ${p}"
  30. return 0
  31. }
  32. load_rc_config $name
  33. run_rc_command "$1"