|OS type and version:||ubuntu 20.04|
On Hetzner-Cloud there is a known issue, that a server lost it’s ipv4 address, because the server doesn’t refresh the ip in the right way.
To fix this, I have created a small bash-script which should run every minute to check if ipv4 is available, if not the script should fetch it via
If I do execute this script as root in cli, it works as expected. But if I put it into Webmin’s cronjobs (or in crontab -e from
root), it doesn’t work.
#!/bin/bash # Checks if the IPv4 address is set on the given network interface interface=eth0 ipString="inet " result=`/usr/sbin/ifconfig $interface | /usr/bin/grep "$ipString"` if [[ -z $result ]]; then /usr/sbin/dhclient $interface `/usr/local/bin/discord_notification SERVER 58 "IPv4 - reconnect (dhclient eth0) "` fi
Any Idea, why this doesn’n work at all.
And on the other side, why do ubuntu (or webmin) lost the ipv4 address (but not the ipv6) from time to time. Might this be a bug of webmin?