Last active
December 14, 2015 22:09
-
-
Save daniel-garcia/5156098 to your computer and use it in GitHub Desktop.
Reindex events modified in the last n seconds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function usage() { | |
echo $0 "[seconds]" | |
} | |
seconds=$1 | |
if [ -z "$seconds" ]; then | |
echo "seconds were not specified" | |
usage | |
exit 1 | |
fi | |
for table in summary archive | |
do | |
cmd="select (unix_timestamp()-$seconds)*1000 into @last_rsync; insert into event_${table}_index_queue (uuid, update_time) select uuid, update_time from event_${table} where update_time>@last_rsync;" | |
echo "executing: $cmd" | |
$ZENHOME/bin/python $ZENHOME/Products/ZenUtils/ZenDB.py --usedb=zep --execsql "$cmd" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment