[ -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