aboutsummaryrefslogtreecommitdiffstats
path: root/testing/consul/consul.initd
diff options
context:
space:
mode:
Diffstat (limited to 'testing/consul/consul.initd')
-rw-r--r--testing/consul/consul.initd18
1 files changed, 16 insertions, 2 deletions
diff --git a/testing/consul/consul.initd b/testing/consul/consul.initd
index 73613d979c..24d727d93d 100644
--- a/testing/consul/consul.initd
+++ b/testing/consul/consul.initd
@@ -1,21 +1,35 @@
-#!/sbin/runscript
+#!/sbin/openrc-run
+CONSUL_LOG_FILE="/var/log/${SVCNAME}.log"
name=consul
+description="A tool for service discovery, monitoring and configuration"
+description_checkconfig="Verify configuration file"
daemon=/usr/sbin/$name
daemon_user=$name
daemon_group=$name
+extra_commands="checkconfig"
+
+start_pre() {
+ checkpath -f -m 0644 -o ${SVCNAME}:${SVCNAME} "$CONSUL_LOG_FILE"
+}
depend() {
need net
after firewall
}
+checkconfig() {
+ consul configtest -config-dir /etc/consul
+}
+
start() {
+ checkconfig || return 1
+
ebegin "Starting ${name}"
start-stop-daemon --start --quiet \
-m --pidfile /var/run/${name}.pid \
--user ${daemon_user} --group ${daemon_group} \
- -b -1 /dev/null -2 /dev/null \
+ -b --stdout $CONSUL_LOG_FILE --stderr $CONSUL_LOG_FILE \
-k 027 --exec ${daemon} -- ${consul_opts}
eend $?
}