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

上一篇:【java】 java 解压tar.gz读取内容


下一篇:Spring+SpringMVC+MyBatis+easyUI整合基础篇(十一)SVN服务器进阶