Search2 ensure running script fails when directory exists
@@ -8,7 +8,7 @@ SOLR_MANAGEMENT_DIR="$( realpath --strip "$( dirname "${BASH_SOURCE[0]}" )" )"
# Check if Solr is installed
VERSION=7.6.0
-if ! ${SOLR_EXTRACT_DIR}/solr/bin/solr -version | grep "${VERSION}"
+if ! ${SOLR_EXTRACT_DIR}/solr/bin/solr -version | grep "${VERSION}" >/dev/null
then
echo "Can not start Solr ${VERSION} as it's not installed."
exit 1
@@ -28,7 +28,7 @@ ZK_HOST="${ZK_HOST}${SOLR_ZK_ROOT}"
PRIVATE_IP=$(cat /etc/appscale/my_private_ip)
solr_zk="${SOLR_EXTRACT_DIR}/solr/bin/solr zk"
-if ${solr_zk} ls ${SOLR_ZK_ROOT} -z "${FIRST_ZK}"
+if ${solr_zk} ls ${SOLR_ZK_ROOT} -z "${FIRST_ZK}" >/dev/null
then
echo "Zookeeper root is already created."
else
@@ -49,10 +49,10 @@ SOLR_MEM_LOW=$(echo "$SOLR_MEM_MAX" | awk '{ printf "%d", $1 * 0.70 }')
# Slow process down when usage is higher.
SOLR_MEM_HIGH=$(echo "$SOLR_MEM_MAX" | awk '{ printf "%d", $1 * 0.90 }')
-mkdir /var/solr7
-sudo chown solr:solr /var/solr7
+mkdir -p /var/solr7
+chown solr:solr /var/solr7
mkdir -p /var/log/appscale/solr
-sudo chown -R solr:solr /var/log/appscale/solr
+chown -R solr:solr /var/log/appscale/solr
export SOLR_HEAP="${SOLR_MEM_HIGH}m"
export MEMORY_LOW="${SOLR_MEM_LOW}M"
@@ -70,17 +70,17 @@ then
echo "/etc/default/solr.in.sh has no changes."
echo "/etc/systemd/system/solr.service has no changes."
echo "Making sure Solr is running."
- sudo systemctl enable solr
- sudo systemctl start solr
+ systemctl enable solr
+ systemctl start solr
else
echo "Copying new solr.in.sh to /etc/default/solr.in.sh"
- sudo cp "/tmp/solr.in.sh" "/etc/default/solr.in.sh"
+ cp "/tmp/solr.in.sh" "/etc/default/solr.in.sh"
echo "Copying new solr.service to /etc/systemd/system/solr.service"
- sudo cp "/tmp/solr.service" "/etc/systemd/system/solr.service"
+ cp "/tmp/solr.service" "/etc/systemd/system/solr.service"
echo "Making sure Solr is restarted."
- sudo systemctl daemon-reload
- sudo systemctl enable solr
- sudo systemctl restart solr
+ systemctl daemon-reload
+ systemctl enable solr
+ systemctl restart solr
fi
echo "Making sure appscale-specific config set is uploaded to zookeeper."
