rc.subr 1.1 KB

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