freebsd-ports/sysutils/consul/files/consul.in
Steve Wills 3d7305f51b sysutils/consul: update to 1.0.1
While here, remove config test because it always fails on hosts with more than
1 IP.
2017-12-05 21:31:37 +00:00

52 lines
1.4 KiB
Bash

#!/bin/sh
# $FreeBSD$
#
# PROVIDE: consul
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# consul_enable (bool): Set to NO by default.
# Set it to YES to enable consul.
# consul_user (user): Set user to run consul.
# Default is "consul".
# consul_group (group): Set group to run consul.
# Default is "consul".
# consul_dir (dir): Set dir to run consul in.
# Default is "/var/db/consul".
. /etc/rc.subr
name=consul
rcvar=consul_enable
extra_commands="reload configtest"
load_rc_config $name
: ${consul_enable:="NO"}
: ${consul_user:="consul"}
: ${consul_group:="consul"}
: ${consul_dir:="/var/db/consul"}
pidfile=/var/run/consul.pid
procname="%%PREFIX%%/bin/consul"
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} /usr/bin/env ${consul_env} ${procname} agent -data-dir=${consul_dir} -config-dir=%%PREFIX%%/etc/consul.d ${consul_args}"
start_precmd=consul_startprecmd
consul_startprecmd()
{
if [ ! -e ${pidfile} ]; then
install -o ${consul_user} -g ${consul_group} /dev/null ${pidfile};
fi
if [ ! -d ${consul_dir} ]; then
install -d -o ${consul_user} -g ${consul_group} ${consul_dir}
fi
}
run_rc_command "$1"