Lines 27-34
Link Here
|
27 |
|
27 |
|
28 |
name=elasticsearch |
28 |
name=elasticsearch |
29 |
rcvar=elasticsearch_enable |
29 |
rcvar=elasticsearch_enable |
30 |
load_rc_config $name |
|
|
31 |
|
30 |
|
|
|
31 |
load_rc_config ${name} |
32 |
|
32 |
: ${elasticsearch_enable:="NO"} |
33 |
: ${elasticsearch_enable:="NO"} |
33 |
: ${elasticsearch_user:=%%SEARCHUSER%%} |
34 |
: ${elasticsearch_user:=%%SEARCHUSER%%} |
34 |
: ${elasticsearch_group:=%%SEARCHGROUP%%} |
35 |
: ${elasticsearch_group:=%%SEARCHGROUP%%} |
Lines 47-53
Link Here
|
47 |
ES_LIB="%%PREFIX%%/lib/elasticsearch" |
48 |
ES_LIB="%%PREFIX%%/lib/elasticsearch" |
48 |
ES_CLASSPATH=$ES_LIB/elasticsearch-%%PORTVERSION%%.jar:$ES_LIB/*:$ES_LIB/sigar/* |
49 |
ES_CLASSPATH=$ES_LIB/elasticsearch-%%PORTVERSION%%.jar:$ES_LIB/*:$ES_LIB/sigar/* |
49 |
|
50 |
|
50 |
|
|
|
51 |
java_options=" -server \ |
51 |
java_options=" -server \ |
52 |
-Xms${elasticsearch_min_mem} \ |
52 |
-Xms${elasticsearch_min_mem} \ |
53 |
-Xmx${elasticsearch_max_mem} \ |
53 |
-Xmx${elasticsearch_max_mem} \ |
Lines 71-77
Link Here
|
71 |
command="/usr/sbin/daemon" |
71 |
command="/usr/sbin/daemon" |
72 |
command_args="-f %%LOCALBASE%%/bin/java -Des.pidfile=${pidfile} ${elasticsearch_props} ${java_options} org.elasticsearch.bootstrap.Elasticsearch" |
72 |
command_args="-f %%LOCALBASE%%/bin/java -Des.pidfile=${pidfile} ${elasticsearch_props} ${java_options} org.elasticsearch.bootstrap.Elasticsearch" |
73 |
|
73 |
|
74 |
elasticsearch_precmd() { |
74 |
elasticsearch_precmd() |
|
|
75 |
{ |
75 |
touch ${pidfile} |
76 |
touch ${pidfile} |
76 |
chown ${elasticsearch_user}:${elasticsearch_group} ${pidfile} |
77 |
chown ${elasticsearch_user}:${elasticsearch_group} ${pidfile} |
77 |
/usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 750 ${elasticsearch_tmp} |
78 |
/usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 750 ${elasticsearch_tmp} |
Lines 79-90
Link Here
|
79 |
/usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 750 /var/log/elasticsearch |
80 |
/usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 750 /var/log/elasticsearch |
80 |
} |
81 |
} |
81 |
|
82 |
|
82 |
elasticsearch_console () { |
83 |
elasticsearch_console() |
|
|
84 |
{ |
83 |
%%LOCALBASE%%/bin/java -Des.foreground=yes ${elasticsearch_props} ${java_options} org.elasticsearch.bootstrap.Elasticsearch |
85 |
%%LOCALBASE%%/bin/java -Des.foreground=yes ${elasticsearch_props} ${java_options} org.elasticsearch.bootstrap.Elasticsearch |
84 |
} |
86 |
} |
85 |
|
87 |
|
86 |
|
88 |
|
87 |
elasticsearch_stop() { |
89 |
elasticsearch_stop() |
|
|
90 |
{ |
88 |
rc_pid=$(elasticsearch_check_pidfile $pidfile) |
91 |
rc_pid=$(elasticsearch_check_pidfile $pidfile) |
89 |
|
92 |
|
90 |
if [ -z "$rc_pid" ]; then |
93 |
if [ -z "$rc_pid" ]; then |
Lines 97-103
Link Here
|
97 |
kill ${rc_pid} 2> /dev/null |
100 |
kill ${rc_pid} 2> /dev/null |
98 |
} |
101 |
} |
99 |
|
102 |
|
100 |
elasticsearch_status() { |
103 |
elasticsearch_status() |
|
|
104 |
{ |
101 |
rc_pid=$(elasticsearch_check_pidfile $pidfile) |
105 |
rc_pid=$(elasticsearch_check_pidfile $pidfile) |
102 |
|
106 |
|
103 |
if [ -z "$rc_pid" ]; then |
107 |
if [ -z "$rc_pid" ]; then |
Lines 108-114
Link Here
|
108 |
echo "${name} is running as pid ${rc_pid}." |
112 |
echo "${name} is running as pid ${rc_pid}." |
109 |
} |
113 |
} |
110 |
|
114 |
|
111 |
elasticsearch_check_pidfile() { |
115 |
elasticsearch_check_pidfile() |
|
|
116 |
{ |
112 |
_pidfile=$1 |
117 |
_pidfile=$1 |
113 |
if [ -z "$_pidfile" ]; then |
118 |
if [ -z "$_pidfile" ]; then |
114 |
err 3 'USAGE: elasticsearch_check_pidfile pidfile' |
119 |
err 3 'USAGE: elasticsearch_check_pidfile pidfile' |
Lines 126-130
Link Here
|
126 |
echo -n $_pid |
131 |
echo -n $_pid |
127 |
fi |
132 |
fi |
128 |
} |
133 |
} |
129 |
load_rc_config ${name} |
134 |
|
130 |
run_rc_command "$1" |
135 |
run_rc_command "$1" |