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 [email protected]
expect "*103.30.4.4's password:"
send "lottery2018\n"
expect "*$"
interact

猜你喜欢

转载自www.cnblogs.com/immense/p/11402859.html
今日推荐