elasticsearch启停脚本systemctl管理

elasticsearch启停脚本

1、启停停脚本

#!/bin/bash
 
APPHOME="/home/work/elasticsearch"
PID=$(cat ${
    APPHOME}/elasticsearch.pid)
case $1 in
          start)
  ${APPHOME}/bin/elasticsearch > /dev/null  2>&1 &
 
  • 4
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
以下是elasticsearch一键脚本的示例: #!/bin/bash # Elasticsearch one-click start script # Define the Elasticsearch home directory ES_HOME=/path/to/elasticsearch # Define the Elasticsearch configuration file ES_CONFIG_FILE=$ES_HOME/config/elasticsearch.yml # Define the Elasticsearch log directory ES_LOG_DIR=$ES_HOME/logs # Define the Elasticsearch data directory ES_DATA_DIR=$ES_HOME/data # Define the Elasticsearch process ID file ES_PID_FILE=$ES_HOME/elasticsearch.pid # Check if Elasticsearch is already running if [ -f $ES_PID_FILE ]; then echo "Elasticsearch is already running. Exiting." exit 1 fi # Start Elasticsearch with the specified configuration file and log directory $ES_HOME/bin/elasticsearch -d -p $ES_PID_FILE --quiet -Epath.logs=$ES_LOG_DIR -Epath.data=$ES_DATA_DIR -Epath.conf=$ES_CONFIG_FILE # Check if Elasticsearch started successfully if [ $? -eq 0 ]; then echo "Elasticsearch started successfully." else echo "Failed to start Elasticsearch." fi # Wait for Elasticsearch to start sleep 10 # Check if Elasticsearch is running if pgrep -f "$ES_HOME/bin/elasticsearch" > /dev/null; then echo "Elasticsearch is running." else echo "Failed to start Elasticsearch." fi 这个脚本Elasticsearch,并使用指定的配置文件、日志目录和数据目录。它还检查Elasticsearch是否已经在运行,并等待10秒钟以确保Elasticsearch已经动。如果Elasticsearch动成功,则脚本会输出Elasticsearch已经成功动的消息。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值