elasticsearch索引清理脚本shell

 

es-index-clear.sh

#!/bin/bash
#----------------------------------------------
# Module: es-index-clear
# Comment: To clear elastic-index on interval!
# Date: 2018/10/5
# Author: aodi
# Version: 1.0
#----------------------------------------------

#循环清理过期索引
while true
do
read -p "请问您要退出还是继续清理索引? 退出[q],清理[c] => "
if [ $REPLY == "c" ]
then
read -p "请问你要清理x天前的过期索引[默认:5] => "
CLEAR_DATE=`date +%Y.%m.%d -d $REPLY" days ago"`
echo '即将清理'$CLEAR_DATE'日期的索引......'
curl -X DELETE 'http://localhost:9200/*-'$CLEAR_DATE >/dev/null 2>&1
echo
elif [ $REPLY == "q" ]
then
exit 0
else
echo 'INPUT INVALID,please re-put...'
fi
done

 

log_expect.sh.bak

#!/usr/bin/expect -f
#spawn ssh lottery@103.30.4.144
expect "*103.30.4.4's password:"
send "lottery2018\n"
expect "*$"
interact

 

posted @ 2019-08-23 21:55  主啊~  阅读(749)  评论(0编辑  收藏  举报