You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

44 lines
1.1 KiB

function swarmlab_ifup() {
swarmlab=$(/bin/bash /data/appl/ok/swarmlab-hybrid-agent/src-local/hybrid/connect/status.sh wg0 | jq .swarmlab)
tempswarm="${swarmlab%\"}"
tempswarm="${tempswarm#\"}"
swarmlab=$tempswarm
echo $swarmlab
}
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
/bin/bash /data/appl/ok/swarmlab-hybrid-agent/src-local/hybrid/connect/swarmlab-connect.sh
sleep 2
hybrid1=$(hybrid_ifup)
if [ $hybrid1 == 'NotOnline' ]; then
echo "Failed to start wg0 network interface"
else
echo "Swarmlab hybrid $hybrid"
fi
else
echo "Swarmlab hybrid $hybrid"
fi
swarmlab=$(swarmlab_ifup)
if [ $swarmlab != 'active' ]; then
sleep 1
swarmlab1=$(swarmlab_ifup)
if [ $swarmlab1 != 'active' ]; then
echo "Failed to connect on swarmlab master"
echo "Exec "
echo "/bin/bash /data/appl/ok/swarmlab-hybrid-agent/src-local/hybrid/connect/reload-swarmlab.sh"
echo "Please try again"
fi
else
echo "Swarmlab master $swarmlab"
fi