Answers for "bash script to restart elasticsearch"

1

bash script to restart elasticsearch

#!/bin/sh

RESTART="/etc/init.d/elasticsearch restart"
SERVICE="elasticsearch"
LOGFILE="/var/log/elasticRestart.log"

ps -ef | grep elastic | grep -v grep > /dev/null
if [ $? -eq 0 ]
then
        /etc/init.d/elasticsearch restart >> /var/log/elasticRestart.log
        echo "Elasticsearch relaunched at $(date)" >> /var/log/elasticRestart.log
else
        echo "Elasticsearch is running $(date)" >> /var/log/elasticRestart.log
fi
Posted by: Guest on July-10-2020

Code answers related to "bash script to restart elasticsearch"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language