Lines 2-28
Link Here
|
2 |
|
2 |
|
3 |
# PROVIDE: consul_template |
3 |
# PROVIDE: consul_template |
4 |
# REQUIRE: NETWORKING SERVERS DAEMON |
4 |
# REQUIRE: NETWORKING SERVERS DAEMON |
5 |
# KEYWORD: shtudown |
5 |
# KEYWORD: shutdown |
6 |
# |
6 |
# |
7 |
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf |
7 |
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf |
8 |
# to enable this service: |
8 |
# to enable this service: |
9 |
# |
9 |
# |
10 |
# consul_template_enable (bool): Set to NO by default. |
10 |
# consul_template_enable (bool): Set to NO by default. |
11 |
# Set it to YES to enable consul-template. |
11 |
# Set it to YES to enable consul-template. |
12 |
# consul_template_user (user): Set user to run consul-template. |
12 |
# consul_template_user (user): Set user to run consul-template. |
13 |
# Default is "root". |
13 |
# Default is "root". |
14 |
# consul_template_group (group): Set group to run consul-template. |
14 |
# consul_template_group (group): Set group to run consul-template. |
15 |
# Default is "wheel". |
15 |
# Default is "wheel". |
16 |
# consul_template_env (string): Set environment variables used with consul-template. |
16 |
# consul_template_env (string): Set environment variables used with consul-template. |
17 |
# Default is "". |
17 |
# Default is "". |
18 |
# consul_template_args (string): Set flags used with consul-template. |
18 |
# consul_template_args (string): Set flags used with consul-template. |
19 |
# Default is "". |
19 |
# Default is "". |
20 |
# consul_template_syslog_output_enable (string): Set to YES to enable syslog output |
20 |
# consul_template_syslog_output_enable (string): Set to YES to enable syslog output |
21 |
# Default is "NO". See daemon(8). |
21 |
# Default is "NO". See daemon(8). |
22 |
# consul_template_syslog_output_priority (str): Set syslog priority if syslog enabled. |
22 |
# consul_template_syslog_output_tag (str): Set syslog tag if syslog enabled. |
23 |
# Default is "info". See daemon(8). |
23 |
# Default is "consul". See daemon(8). |
24 |
# consul_template_syslog_output_facility (str): Set syslog facility if syslog enabled. |
24 |
# consul_template_syslog_output_priority (str): Set syslog priority if syslog enabled. |
25 |
# Default is "daemon". See daemon(8). |
25 |
# Default is "info". See daemon(8). |
|
|
26 |
# consul_template_syslog_output_facility (str): Set syslog facility if syslog enabled. |
27 |
# Default is "daemon". See daemon(8). |
26 |
|
28 |
|
27 |
. /etc/rc.subr |
29 |
. /etc/rc.subr |
28 |
|
30 |
|
Lines 34-45
load_rc_config $name
Link Here
|
34 |
: ${consul_template_enable:="NO"} |
36 |
: ${consul_template_enable:="NO"} |
35 |
: ${consul_template_user:="root"} |
37 |
: ${consul_template_user:="root"} |
36 |
: ${consul_template_group:="wheel"} |
38 |
: ${consul_template_group:="wheel"} |
37 |
: ${consul_template_env:=""} |
|
|
38 |
: ${consul_template_args:=""} |
39 |
: ${consul_template_syslog_output_enable:="NO"} |
39 |
: ${consul_template_syslog_output_enable:="NO"} |
40 |
|
40 |
|
|
|
41 |
start_precmd="consul_template_start_precmd" |
42 |
|
41 |
if checkyesno consul_template_syslog_output_enable; then |
43 |
if checkyesno consul_template_syslog_output_enable; then |
42 |
consul_template_syslog_output_flags="-T ${name}" |
44 |
if [ -n "${consul_template_syslog_output_tag}" ]; then |
|
|
45 |
consul_template_syslog_output_flags="-T ${consul_template_syslog_output_tag}" |
46 |
else |
47 |
consul_template_syslog_output_flags="-T ${name}" |
48 |
fi |
43 |
if [ -n "${consul_template_syslog_output_priority}" ]; then |
49 |
if [ -n "${consul_template_syslog_output_priority}" ]; then |
44 |
consul_template_syslog_output_flags="${consul_template_syslog_output_flags} -s ${consul_template_syslog_output_priority}" |
50 |
consul_template_syslog_output_flags="${consul_template_syslog_output_flags} -s ${consul_template_syslog_output_priority}" |
45 |
fi |
51 |
fi |
Lines 49-67
if checkyesno consul_template_syslog_output_enable; then
Link Here
|
49 |
fi |
55 |
fi |
50 |
fi |
56 |
fi |
51 |
|
57 |
|
52 |
pidfile=/var/run/consul-template.pid |
58 |
pidfile="/var/run/consul-template.pid" |
53 |
procname="%%PREFIX%%/bin/consul-template" |
59 |
procname="%%PREFIX%%/bin/consul-template" |
54 |
command="/usr/sbin/daemon" |
60 |
command="/usr/sbin/daemon" |
55 |
command_args="-f -t ${name} ${consul_template_syslog_output_flags} -p ${pidfile} /usr/bin/env ${consul_template_env} ${procname} -config=%%PREFIX%%/etc/consul-template.d ${consul_template_args}" |
61 |
command_args="-f -t ${name} ${consul_template_syslog_output_flags} -p ${pidfile} /usr/bin/env ${consul_template_env} ${procname} -config=%%PREFIX%%/etc/consul-template.d ${consul_template_args}" |
56 |
sig_stop="INT" |
62 |
sig_stop="INT" |
57 |
|
63 |
|
58 |
start_precmd=consul_template_startprecmd |
64 |
consul_template_start_precmd() |
59 |
|
|
|
60 |
consul_template_startprecmd() |
61 |
{ |
65 |
{ |
62 |
if [ ! -e ${pidfile} ]; then |
66 |
if [ ! -e ${pidfile} ]; then |
63 |
install -o ${consul_template_user} -g ${consul_template_group} /dev/null ${pidfile} |
67 |
install -m 0600 -o ${consul_template_user} -g ${consul_template_group} /dev/null "${pidfile}" |
64 |
fi |
68 |
fi |
65 |
} |
69 |
} |
66 |
|
70 |
|
67 |
run_rc_command "$1" |
71 |
run_rc_command "$1" |