function hybrid_ifup() { hybrid=$(/bin/bash /data/appl/ok/swarmlab-hybrid-agent/src-local/hybrid/connect/status.sh wg0 | jq .hybrid) tempswarm1="${hybrid%\"}" tempswarm1="${tempswarm1#\"}" hybrid=$tempswarm1 echo $hybrid } hybrid=$(hybrid_ifup) if [ $hybrid == 'NotOnline' ]; then echo "Swarmlab hybrid $hybrid" else ip link set wg0 down ip link del wg0 sleep 3 hybrid1=$(hybrid_ifup) if [ $hybrid1 == 'NotOnline' ]; then echo "Swarmlab hybrid $hybrid" else echo "Swarmlab hybrid $hybrid" fi fi