vendredi 27 avril 2018

Two "if" conditions in the same time

I am writing a script to bring me data from other nodes via ssh in a multi selection choice menu, and i want to display a message according to this data.

    if [[ "$option" == "1" ]]
 then
ssh skyusr@<IP> "export JAVA_HOME=/opt/mesosphere && /var/lib/mesos/slave/slaves/*/frameworks/*/executors/*/runs/latest/apache-cassandra-3.0.10/bin/nodetool -p 7199 status" | sed -n '6,10p' | awk '{print $1,$2}' | grep DN > $file_name
        if [ -s $file_name ]
        then
        echo "All Cassandra Nodes are UP !"
        else cat "$file_name"
        fi
fi

When i execute the script, i see it does not see the second if condition to display the message .

What is the correct syntax ?

Aucun commentaire:

Enregistrer un commentaire