aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/docs/CHANGELOG.md1
-rw-r--r--run/anubis.freebsd34
2 files changed, 35 insertions, 0 deletions
diff --git a/docs/docs/CHANGELOG.md b/docs/docs/CHANGELOG.md
index 37bf3b4..e602ad5 100644
--- a/docs/docs/CHANGELOG.md
+++ b/docs/docs/CHANGELOG.md
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Whitelisted [DuckDuckBot](https://duckduckgo.com/duckduckgo-help-pages/results/duckduckbot/) in botPolicies
- Improvements to build scripts to make them less independent of the build host
- Improved the OpenGraph error logging
+- Added FreeBSD rc.d script so can be run as a FreeBSD daemon.
## v1.16.0
diff --git a/run/anubis.freebsd b/run/anubis.freebsd
new file mode 100644
index 0000000..1c980fb
--- /dev/null
+++ b/run/anubis.freebsd
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# PROVIDE: anubis
+# REQUIRE: NETWORKING
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name=anubis
+rcvar=anubis_enable
+
+load_rc_config ${name}
+
+: ${anubis_enable="NO"}
+: ${anubis_user="anubis"}
+: ${anubis_bin="/usr/local/bin/anubis"}
+: ${anubis_environment_file="/etc/anubis.env"}
+
+command=/usr/sbin/daemon
+procname=${anubis_bin}
+pidfile=/var/run/anubis.pid
+logfile=/var/log/anubis.log
+command_args="-c -f -p ${pidfile} -o ${logfile} ${procname}"
+start_precmd=anubis_precmd
+
+anubis_precmd () {
+ export $(xargs < ${anubis_environment_file})
+ if [ ! -f ${logfile} ]; then
+ install -o anubis /dev/null ${logfile}
+ fi
+ install -o anubis /dev/null ${pidfile}
+}
+
+run_rc_command "$1"