Ben zookeeper yükler aşağıdaki gibi bir bash betiği var ama sadece zaten yüklü değilse.
##zookeper
installZook(){
ZOOK_VERSION="3.4.5"
ZOOK_TOOL="zookeeper-${ZOOK_VERSION}"
ZOOK_DOWNLOAD_URL="http://www.us.apache.org/dist/zookeeper/${ZOOK_TOOL}/${ZOOK_TOOL}.tar.gz"
if [ -e $DEFAULT_INSTALLATION_DEST/${ZOOK_TOOL} ]; then
echo "${ZOOK_TOOL} alreay installed";
exit 1; # <<<< here
elif [ ! -e $DEFAULT_SOURCE_ROOT/${ZOOK_TOOL}.tar.gz ]; then
wgetIt $ZOOK_DOWNLOAD_URL
else
echo "[info] : $DEFAULT_SOURCE_ROOT/$ZOOK_TOOL already exists"
fi
sudo mkdir -p /var/lib/zookeeper
sudo mkdir -p /var/log/zookeeper
tarIt "$DEFAULT_SOURCE_ROOT/$ZOOK_TOOL.tar.gz"
sudo chmod 777 -R $DEFAULT_INSTALLATION_DEST/$ZOOK_TOOL
cp $DEFAULT_INSTALLATION_DEST/$ZOOK_TOOL/conf/zoo_sample.cfg $DEFAULT_INSTALLATION_DEST/$ZOOK_TOOL/conf/zoo.cfg
cat >> ~/.bash_profile <<'EOF'
###############################
########### ZOOK ###############
###############################
ZOOK_HOME=/usr/local/zookeper-3.4.5
export ZOOK_HOME
export PATH=$PATH:$ZOOK_HOME/bin
EOF
}
İşaretli satırda <<<< here
, eğer zookeeper zaten kurulu ise, istediğim altındaki komut dosyasından çıkmaktır. Ancak kullanmak exit
terminalin kendisinden çıkar.
return 1
yerine kullanmakexit 1