summaryrefslogtreecommitdiff
path: root/src/rpm/scripts/preremove
blob: 1627c19c7aa42b070fd5744495b04c862ab0b11e (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

[ -f /etc/sysconfig/elasticsearch ] && . /etc/sysconfig/elasticsearch

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
}

# Removal: $1 == 0
# Dont do anything on upgrade, because the preun script in redhat gets executed after the postinst (madness!)
if [ $1 -eq 0 ] ; then

    if [ -x /bin/systemctl ] ; then
        /bin/systemctl --no-reload disable elasticsearch.service > /dev/null 2>&1 || :
    fi

    if [ -x /sbin/chkconfig ] ; then
        /sbin/chkconfig --del elasticsearch 2> /dev/null
    fi

	stopElasticsearch
fi

exit 0