Posts

Showing posts from January, 2019

how to execute multiple lines of code inside SSH in bash script

Image
0 I want to execute below code,but it is highlighting error in code with red in vi. Getting error after sudo ssh -t root@$ip << EOF line .Where have I scripted wrongly? #!/bin/bash cassandra_home=$(python -c "import json; print ",".join(json.load(open('${repair.json}','r'))["cassandra_home"])") iplist[@]=$(python -c "import json; print ",".join(json.load(open('${repair.json}','r'))["iplist"])") for ip in ${iplist[@]} do sudo ssh -t root@$ip << EOF for ip in ${iplist[@]} do echo Checking $ip for ongoing repairs ${cassandra_home}nodetool -h $ip tpstats | grep Repair# response=$? if [ $response -eq 0 ]; then repair_ongoing=true echo "Ongoing repa...