netdata.in 900 B

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