rc.subr 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. # $FreeBSD: ports/security/tor-devel/files/tor.in,v 1.1 2006/02/17 22:21:25 mnag Exp $
  3. #
  4. # (rc.subr written by Peter Thoenen for Net/FreeBSD)
  5. #
  6. # REQUIRE: NETWORKING SERVERS USR
  7. # BEFORE: LOGIN
  8. #
  9. # Add the following lines to /etc/rc.conf to enable tor
  10. #
  11. # tor_enable (bool): Set to "NO" by default
  12. # Set it to "YES" to enable tor
  13. # tor_conf (str): Points to your tor conf file
  14. # Default: /usr/local/etc/tor/torrc
  15. # tor_user (str): Tor Daemon user. Default _tor
  16. #
  17. . /etc/rc.subr
  18. name="tor"
  19. rcvar=${name}_enable
  20. load_rc_config ${name}
  21. : ${tor_enable="NO"}
  22. : ${tor_conf="/usr/local/etc/tor/torrc"}
  23. : ${tor_user="_tor"}
  24. : ${tor_pidfile="/var/run/tor/tor.pid"}
  25. : ${tor_logfile="/var/log/tor"}
  26. : ${tor_datadir="/var/run/tor"}
  27. required_files=${tor_conf}
  28. required_dirs=${tor_datadir}
  29. command="/usr/local/bin/${name}"
  30. command_args="-f ${tor_conf} --pidfile ${tor_pidfile} --runasdaemon 1 --datadirectory ${tor_datadir} --user ${tor_user}"
  31. extra_commands="log"
  32. log_cmd="${name}_log"
  33. tor_log() {
  34. cat ${tor_logfile}
  35. }
  36. run_rc_command "$1"