Hello,
i have a Script wich should Update the Remote IP of a Tunnel Interface every Minute, if the IP of the Remote Site Changes. The Script gets the IP of the Remote Site via DNS.
If i run the Script manually it works fine, but if the Task Scheduler Starts it the IP doesn´t get Updated.
I put a mkdir in the script and the folder was created via the Task Scheduler. So the Script seems to run, but i dont understand why the IP wasn´t updated.
Script:
#!/bin/vbash
mkdir /home/vyos/test
source /opt/vyatta/etc/functions/script-template
newIP=$(getent hosts ipv6.mydnsname.cake | awk '{ print $1 }')
oldIP=$(show interfaces tunnel tun0 remote | awk '{ print $2 }')
echo $newIP
echo $oldIP
if [ $newIP != $oldIP ]
then
configure
set interfaces tunnel tun0 remote $newIP
commit
save
fi
Task Scheduler Configuration:
vyos@IX# show system task-scheduler
task updateTunnelIP {
executable {
path /home/vyos/updateTunnelIP.sh
}
interval 1m
}