Line 0
Link Here
|
|
|
1 |
#!/bin/sh |
2 |
|
3 |
# $FreeBSD$ |
4 |
# |
5 |
# Salt Proxy startup script |
6 |
# |
7 |
# PROVIDE: salt_proxy |
8 |
# REQUIRE: LOGIN |
9 |
# KEYWORD: shutdown |
10 |
|
11 |
# Add the following to /etc/rc.conf[.local] to enable this service |
12 |
# |
13 |
# salt_proxy_enable (bool): Set to NO by default. |
14 |
# Set it to YES to enable salt_proxy. |
15 |
# salt_proxy_paths (string): Set to "/sbin:/bin:/usr/sbin:/usr/bin:%%PREFIX%%/bin:%%PREFIX%%/sbin" by default. |
16 |
# Default $PATH for Salt |
17 |
# salt_proxy_eggcache (string): Set to "/tmp" by default. |
18 |
# Allows defining egg cache directory to fix runtime on diskless systems. |
19 |
# salt_proxy_list (string): Set to "" by default. |
20 |
# Space separated list of proxies. |
21 |
# |
22 |
|
23 |
. /etc/rc.subr |
24 |
|
25 |
name=salt_proxy |
26 |
rcvar=salt_proxy_enable |
27 |
|
28 |
load_rc_config ${name} |
29 |
|
30 |
: ${salt_proxy_enable:=NO} |
31 |
: ${salt_proxy_paths=/sbin:/bin:/usr/sbin:/usr/bin:%%PREFIX%%/bin:%%PREFIX%%/sbin} |
32 |
: ${salt_proxy_eggcache=/tmp} |
33 |
|
34 |
start_cmd=salt_proxy_start |
35 |
|
36 |
command="%%PREFIX%%/bin/salt-proxy" |
37 |
command_interpreter="%%PYTHON_CMD%%" |
38 |
required_files="%%PREFIX%%/etc/salt" |
39 |
command_args="-c ${required_files} -d" |
40 |
|
41 |
export PATH="${salt_minion_paths}" |
42 |
export PYTHON_EGG_CACHE="${salt_minion_eggcache}" |
43 |
|
44 |
salt_proxy_start() |
45 |
{ |
46 |
if [ -n "${salt_proxy_list}" ]; then |
47 |
echo "${salt_proxy_list} is undefined" |
48 |
return 1 |
49 |
fi |
50 |
|
51 |
local _proxy |
52 |
|
53 |
for _proxy in ${salt_proxy_list}; do |
54 |
echo "Starting salt-proxy: ${_proxy}" |
55 |
${command_interpreter} ${command} --proxyid ${_proxy} ${command_args} |
56 |
done |
57 |
} |
58 |
|
59 |
run_rc_command "$1" |