Script to continuously check Cassandra aliveness using cqlsh tool

Typically I use it to check Cassandra running on Kubernetes cluster during rolling updates:

while true; \
do \
cqlsh -u {{ username }} -p {{ password }} {{ hostname }} {{ port }} \
--execute "SELECT now() FROM system.local;"; \
sleep 2; \
done