You could everything through the API.
- list all the snapshots in the repository
- parse the JSON returned
- for each snapshot, if it's older than 7 days, delete the snapshot
Le mardi 20 janvier 2015 19:19:38 UTC-2, abutalib zaidi a écrit :
I am fairly new to Elasticsearch and was trying to do some backup and
restore using the API. I wrote a shell script to remove snapshots older
than certain days but it somehow removes the repo instead of the snapshots
info stored in a variable. Any help would be appreciated:#Remove snapshots older than 7 days
cd /snapshot/directoryOLD_BACKUP=
find snapshot-* -mtime +7OLD_SNAPSHOT=
for filename in ${OLD_BACKUP}; do [ -f "$filename" ] || continue mv $filename ${filename//snapshot-/} donecurl -XDELETE "xyz.com:9200/_snapshot/handoff_backup/${OLD_SNAPSHOT}
http://argentina.pdi.com:9200/_snapshot/handoff_backup/${OLD_SNAPSHOT}
"
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/da6a210c-3949-4e0d-aaa5-4e05ebf14248%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.