Added
Link Here
|
1 |
#!/bin/sh |
2 |
|
3 |
# PROVIDE: promxy |
4 |
# REQUIRE: NETWORKING SERVERS DAEMON |
5 |
# KEYWORD: shutdown |
6 |
# |
7 |
# Add the following lines to /etc/rc.conf or /etc/rc.conf.local |
8 |
# to enable this service: |
9 |
# |
10 |
# promxy_enable: Enable Promxy |
11 |
# Default: NO |
12 |
# promxy_user: Username to run Promxy |
13 |
# Default: %%USERS%% |
14 |
# promxy_config: Configuration file to run Promxy |
15 |
# Default: %%ETCDIR%%/config.yaml |
16 |
# promxy_pidfile: Full path of the Promxy process PID file |
17 |
# Default: /var/run/promxy.pid |
18 |
# promxy_remediate_enable: Enable auto-restart if Promxy's been terminated |
19 |
# Default: NO |
20 |
# promxy_remediate_delay: Auto-restart delay if auto-restart enabled |
21 |
# Default: 5 |
22 |
# promxy_syslog_output_enable: Enable syslog output. |
23 |
# Default: YES |
24 |
# promxy_syslog_output_tag: Syslog tag if syslog output enabled. |
25 |
# Default: promxy |
26 |
# promxy_syslog_output_priority: Syslog priority if syslog output enabled. |
27 |
# Default: info |
28 |
# promxy_syslog_output_facility: Syslog facility if syslog output enabled. |
29 |
# Default: daemon |
30 |
|
31 |
. /etc/rc.subr |
32 |
|
33 |
name=promxy |
34 |
rcvar=promxy_enable |
35 |
|
36 |
load_rc_config "${name}" |
37 |
|
38 |
: ${promxy_enable:="NO"} |
39 |
: ${promxy_user:="%%USERS%%"} |
40 |
: ${promxy_config:="%%ETCDIR%%/config.yaml"} |
41 |
: ${promxy_pidfile:=/var/run/promxy.pid} |
42 |
: ${promxy_remediate_enable:="NO"} |
43 |
: ${promxy_remediate_delay="5"} |
44 |
: ${promxy_syslog_output_enable:="YES"} |
45 |
: ${promxy_syslog_output_tag:="${name}"} |
46 |
: ${promxy_syslog_output_priority:="info"} |
47 |
: ${promxy_syslog_output_facility:="daemon"} |
48 |
|
49 |
if checkyesno promxy_syslog_output_enable; then |
50 |
if [ -n "${promxy_syslog_output_tag}" ]; then |
51 |
promxy_syslog_output_flags="-T ${promxy_syslog_output_tag}" |
52 |
fi |
53 |
if [ -n "${promxy_syslog_output_priority}" ]; then |
54 |
promxy_syslog_output_flags="${promxy_syslog_output_flags} -s ${promxy_syslog_output_priority}" |
55 |
fi |
56 |
if [ -n "${promxy_syslog_output_facility}" ]; then |
57 |
promxy_syslog_output_flags="${promxy_syslog_output_flags} -l ${promxy_syslog_output_facility}" |
58 |
fi |
59 |
fi |
60 |
|
61 |
if checkyesno promxy_remediate_enable; then |
62 |
if [ -n "${promxy_remediate_delay}" ]; then |
63 |
promxy_remediate_flags="-R ${promxy_remediate_delay}" |
64 |
fi |
65 |
fi |
66 |
|
67 |
pidfile="${promxy_pidfile}" |
68 |
required_files="${promxy_config}" |
69 |
|
70 |
promxy_bin="%%PREFIX%%/bin/promxy" |
71 |
command="/usr/sbin/daemon" |
72 |
command_args="-u ${promxy_user} ${promxy_remediate_flags} -f ${promxy_syslog_output_flags} -P ${pidfile} ${promxy_bin} --config=${promxy_config}" |
73 |
|
74 |
# Run daemon(8) as root |
75 |
unset promxy_user |
76 |
|
77 |
run_rc_command "$1" |