From 390b67f898a35fece0a1f084f5100ff9edcc38ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Sat, 5 Nov 2022 15:57:49 +0100 Subject: [PATCH] Add a rc.d script --- contrib/rc.d/acmed | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 contrib/rc.d/acmed diff --git a/contrib/rc.d/acmed b/contrib/rc.d/acmed new file mode 100755 index 0000000..31c7c03 --- /dev/null +++ b/contrib/rc.d/acmed @@ -0,0 +1,35 @@ +#!/bin/sh + +# PROVIDE: acmed +# REQUIRE: LOGIN cleanvar +# KEYWORD: shutdown + +. /etc/rc.subr + +name="acmed" +rcvar="${name}_enable" +pidfile="/var/run/${name}.pid" +acmed_config_file="/usr/local/etc/acmed/acmed.toml" +required_files="${acmed_config_file}" +command="/usr/local/bin/${name}" +start_precmd="${name}_prestart" + +load_rc_config "$name" +: ${acmed_enable:=no} +: ${acmed_log_level:="info"} +: ${acmed_root_cert:=} + +acmed_prestart() +{ + if [ "$acmed_root_cert" != "" ]; then + rc_flags="--root-cert ${acmed_root_cert} ${rc_flags}" + fi + if [ "$acmed_log_level" != "" ]; then + rc_flags="--log-level ${acmed_log_level} ${rc_flags}" + fi + rc_flags="--log-syslog ${rc_flags}" + rc_flags="--pid-file ${pidfile} ${rc_flags}" + rc_flags="--config ${acmed_config_file} ${rc_flags}" +} + +run_rc_command "$1"