Created
September 15, 2012 15:25
-
-
Save duydo/3728456 to your computer and use it in GitHub Desktop.
elasticsearch script
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
#!/bin/bash | |
NAME=elasticsearch | |
PREFIX=/usr/local | |
ES_HOME=$PREFIX/$NAME | |
install() { | |
v=$1; | |
echo "Downloading $NAME $v..."; | |
file="$NAME-$v.tar.gz"; | |
wget -c "https://github.com/downloads/elasticsearch/elasticsearch/$file"; | |
echo "Downloaded"; | |
echo "Extracting $file..." | |
tar xfvz $file -C $PREFIX | |
echo "Extracted" | |
echo "Create a link $PREFIX/$NAME-$v --> $PREFIX/$NAME" | |
ln -sfn $PREFIX/$NAME-$v $PREFIX/$NAME | |
echo "Installing elasticsearch-head plugin..."; | |
$PREFIX/$NAME/bin/plugin -install mobz/elasticsearch-head | |
echo "Cleaning..." | |
rm -f $file; | |
echo "DONE"; | |
} | |
remove() { | |
echo 'NOT SUPPORTED YET'; | |
} | |
start() { | |
$ES_HOME/bin/elasticsearch -f -Des.path.logs=$HOME/.$NAME/logs -Des.path.data=$HOME/.$NAME/data | |
} | |
case "$1" in | |
install) | |
install $2 | |
;; | |
remove) | |
remove | |
;; | |
start) | |
start | |
;; | |
*) | |
echo "$1 is not supported." | |
echo "Usage: $0 {install|remove|start}" | |
exit 3 | |
esac | |
exit 0 |
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
This is quick and dirty script to install elasticsearch. | |
Usage: | |
Install: elasticsearch install <version> | |
Start: elasticsearch start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment