Last active
November 8, 2018 14:57
-
-
Save MitarashiDango/298d827756f5efe52bcbc424b755fc92 to your computer and use it in GitHub Desktop.
Elasticsearchのプラグインを一括更新するやつ
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 | |
ELASTICSEARCH_DIR=/usr/share/elasticsearch | |
cd $ELASTICSEARCH_DIR | |
systemctl stop elasticsearch | |
PLUGIN_LIST="$(bin/elasticsearch-plugin list -s)" | |
echo "Update required plugins." | |
echo "-------------------------------------" | |
echo "$PLUGIN_LIST" | while read PLUGIN_NAME | |
do | |
echo "$PLUGIN_NAME" | |
done | |
echo "-------------------------------------" | |
echo "[1] Uninstall plugins" | |
echo "$PLUGIN_LIST" | while read PLUGIN_NAME | |
do | |
echo "Update: $PLUGIN_NAME" | |
echo "Uninstalling..." | |
bin/elasticsearch-plugin remove $PLUGIN_NAME | |
if [[ $? -ne 0 ]]; then | |
echo "Aborted." | |
exit | |
fi | |
echo "Uninstalled." | |
done | |
echo "[2] Reinstall plugins" | |
echo "$PLUGIN_LIST" | while read PLUGIN_NAME | |
do | |
echo "Reinstalling..." | |
bin/elasticsearch-plugin install $PLUGIN_NAME | |
if [[ $? -ne 0 ]]; then | |
echo "Aborted." | |
exit | |
fi | |
echo "Installed." | |
done | |
systemctl start elasticsearch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment