blob: 317f7fe4029dffa84405d076ec45ede377323590 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
[ -f /etc/sysconfig/elasticsearch ] && . /etc/sysconfig/elasticsearch
startElasticsearch() {
if [ -x /bin/systemctl ] ; then
/bin/systemctl start elasticsearch.service
elif [ -x /etc/init.d/elasticsearch ] ; then
/etc/init.d/elasticsearch start
# older suse linux distributions do not ship with systemd
# but do not have an /etc/init.d/ directory
# this tries to start elasticsearch on these as well without failing this script
elif [ -x /etc/rc.d/init.d/elasticsearch ] ; then
/etc/rc.d/init.d/elasticsearch start
fi
}
stopElasticsearch() {
if [ -x /bin/systemctl ] ; then
/bin/systemctl stop elasticsearch.service > /dev/null 2>&1 || :
elif [ -x /etc/init.d/elasticsearch ] ; then
/etc/init.d/elasticsearch stop
elif [ -x /etc/rc.d/init.d/elasticsearch ] ; then
/etc/rc.d/init.d/elasticsearch stop
fi
}
# Initial installation: $1 == 1
# Upgrade: $1 == 2, and configured to restart on upgrade
if [ $1 -eq 1 ] ; then
if [ -x /bin/systemctl ] ; then
echo "### NOT starting on installation, please execute the following statements to configure elasticsearch to start automatically using systemd"
echo " sudo /bin/systemctl daemon-reload"
echo " sudo /bin/systemctl enable elasticsearch.service"
echo "### You can start elasticsearch by executing"
echo " sudo /bin/systemctl start elasticsearch.service"
elif [ -x /sbin/chkconfig ] ; then
echo "### NOT starting on installation, please execute the following statements to configure elasticsearch to start automatically using chkconfig"
echo " sudo /sbin/chkconfig --add elasticsearch"
echo "### You can start elasticsearch by executing"
echo " sudo service elasticsearch start"
fi
elif [ $1 -ge 2 -a "$RESTART_ON_UPGRADE" == "true" ] ; then
stopElasticsearch
startElasticsearch
fi
|