Created
January 24, 2015 20:35
-
-
Save maltejk/5f077939d0f6022a9ca4 to your computer and use it in GitHub Desktop.
BackupPC DumpPreUserCmd-Script für Solr Nodes. Erstellt Snapshots über die Replication-API und wartet bis diese fertig sind.
This file contains 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
#!/bin/bash | |
_solr_collections="collection1 webgraph" | |
_solr_datapath="/home/solr/solr/example/solr" | |
# hier: multilog | |
_solr_logpath="/home/solr/.service/solr/log/main/current" | |
# nichts, was urlencoded werden muss | |
_solr_snapshot_suffix="-backuppc" | |
# faulheit ftw | |
_null="/dev/null" | |
for __collection in $_solr_collections; do | |
echo "$(date) snapshotting solr database ${__collection} into ${__collection}${_solr_snapshot_suffix} ..." | |
curl -s "http://localhost:8983/solr/${__collection}/replication?command=backup&numberToKeep=1&name=${__collection}${_solr_snapshot_suffix}" | grep OK >$_null || exit 1 | |
echo -n "$(date) waiting for ${__collection} snapshot to complete " | |
while ! ( inotifywait -q -e modify $_solr_logpath >$_null && grep -v "solr.core.SolrCore" $_solr_logpath | grep "${__collection}${_solr_snapshot_suffix}" >$_null ) ; do | |
sleep 1; | |
echo -n "." | |
done | |
echo ; echo "$(date) done." | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment