i'm trying to write a simple bash script for a cronjob to check if some interfaces (tunnels) exsisting. if not i'd like to start another script that (re)starts them. my problem is: i don't get the "IF" working:
#!bin/bash
for i in tun1 tun2 tun3 tun3 tun4 tun5
do OUT="$(ip a show $i up)";
if [[ $OUT == *"does not exist."* ]]; then
echo "$i is down"
else
echo "$i is up"
fi
done
current output is:
./check_tunnel.sh
tun1 is up
tun2 is up
tun3 is up
tun3 is up
tun4 is up
Device "tun5" does not exist.
tun5 is up