PageRenderTime 58ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 0ms

/external/bsd/blacklist/etc/rc.d/blacklistd

http://www.minix3.org/
Shell | 57 lines | 31 code | 9 blank | 17 comment | 4 complexity | 64947995e07cee2b80ba9f09c4da1724 MD5 | raw file
Possible License(s): MIT, WTFPL, AGPL-1.0, BSD-3-Clause, GPL-3.0, LGPL-2.0, JSON, 0BSD
  1. #!/bin/sh
  2. #
  3. # $NetBSD: blacklistd,v 1.1 2015/01/22 17:49:41 christos Exp $
  4. #
  5. # PROVIDE: blacklistd
  6. # REQUIRE: npf
  7. # BEFORE: SERVERS
  8. $_rc_subr_loaded . /etc/rc.subr
  9. name="blacklistd"
  10. rcvar=$name
  11. command="/sbin/${name}"
  12. pidfile="/var/run/${name}.pid"
  13. required_files="/etc/${name}.conf"
  14. start_precmd="${name}_precmd"
  15. extra_commands="reload"
  16. _sockfile="/var/run/${name}.sockets"
  17. _sockname="blsock"
  18. blacklistd_precmd()
  19. {
  20. # Create default list of blacklistd sockets to watch
  21. #
  22. ( umask 022 ; > $_sockfile )
  23. # Find /etc/rc.d scripts with "chrootdir" rcorder(8) keyword,
  24. # and if $${app}_chrootdir is a directory, add appropriate
  25. # blacklistd socket to list of sockets to watch.
  26. #
  27. for _lr in $(rcorder -k chrootdir /etc/rc.d/*); do
  28. (
  29. _l=${_lr##*/}
  30. load_rc_config ${_l}
  31. eval _ldir=\$${_l}_chrootdir
  32. if checkyesno $_l && [ -n "$_ldir" ]; then
  33. echo "${_ldir}/var/run/${_sockname}" >> $_sockfile
  34. fi
  35. )
  36. done
  37. # If other sockets have been provided, change run_rc_command()'s
  38. # internal copy of $blacklistd_flags to force use of specific
  39. # blacklistd sockets.
  40. #
  41. if [ -s $_sockfile ]; then
  42. echo "/var/run/${_sockname}" >> $_sockfile
  43. rc_flags="-P $_sockfile $rc_flags"
  44. fi
  45. return 0
  46. }
  47. load_rc_config $name
  48. run_rc_command "$1"