202103-30 使用elasticsearch定时删除索引数据 1、有的时候我们在使用ES由于资源有限或业务需求,我们只想保存最近一段时间的数据,所以有必要做定时删除数据。2、编写脚本vimdel_es_by_day.sh#!/bin/bash#定时删除elasticsearch索引#authormenard2019-3-25date=`date-d"-7days""+%Y.%m.%d"`/usr/bin/curl-v--userelastic:password-XDELETE"http://192.168.10.201:9200/*-$date"增加可执行权限chmod+xdel_es_by_day.sh3、创建用于测试的索引puttest-2019.03.18p... 继续阅读 >
202010-09 Linux使用shell脚本定时删除历史日志文件 1、tools目录文件结构[root@wwwtools]#treetools/tools/├──bin│├──del_history_files│└──etc├──del_history_files.cfg2directories,2files2、删除历史文件脚本del_history_files[root@wwwtools]#moretools/bin/del_history_files#!/bin/sh#删除指定目录下,文件时间早于指定时间节点的文件,时间粒度:小时#配置文件格式:需清理的目录=小时数###definerestrictedpathPATH="/bin:/usr/... 继续阅读 >