How to update changed IP Address automatically?

That doesn’t feel quite right in cases where there is no IP, though? I mean, it sounds like it’s going to update virtual hosts…but, if virtual hosts don’t have an IP, seems misleading or at least not intuitive.

Then again, this is a pretty unusual situation, so maybe not something that needs a lot of time put into it.

If a <VirtualHost> block has a star instead of an IP, then this script won’t change it…

If you want to try this out, download https://raw.githubusercontent.com/virtualmin/virtualmin-gpl/9febce66b169b8b5995715dc761958263def5189/modify-all-ips.pl and put it in /usr/share/webmin/virtual-server . You can then run it with virtualmin modify-all-ips

@Jamie am I doing this right? so I used wget to download to the location /usr/share/webmin/virtual-server, gave it the same permissions chmod 755. then via command line run virtualmin modify-all-ips however I get an error:

Am I supposed to be calling this from command line in this test or some virtualmin web menu? Could you tell me exactly how to run it please i’m not very experienced with webmin/virtualmin.

I have also called it from webmin bootup actions menu, created the bootup action. when I click run I get the same error.

If I cd /usr/local/bin/perl the directory is empty. Does the Virtualmin Installer script not install perl? I am out of my depth at this point as I dont have any experience with perl. @Joe you no doubt no the answer to this if your around today.

In addition to the above I also tried creating a webmin bootup action as follows which is set to run on boot:

Rebooted and same prompt exists on dashboard with the option to update ip address " Warning!
Your system’s primary IP address appears to have changed from 192.168.62.13 to 172.29.50.133. Virtual servers using the old address may be unreachable or serve the wrong web content."

Also when I run directly from the webmin bootup actions screen I get the following error:

/sbin/virtualmin: /usr/share/webmin/virtual-server/modify-all-ips.pl: /usr/local/bin/perl: bad interpreter: No such file or directory
/sbin/virtualmin: line 46: /usr/share/webmin/virtual-server/modify-all-ips.pl: Success

When I cd /usr/local/bin/perl the directory is empty.

Does the virtualmin installer not install perl? I’m out of my depth at this point as I dont know what it is or how to use it.

You need to change it to point to your perl. Virtualmin installs everything from system packages, including Perl if needed, which never put anything in /usr/local. (The path in Webmin files gets updated during installation from a package.)

I installed Virtualmin via the installscript. I have not manually installed perl at any point.

What exactly do i need to do?

Thanks,

James.

The file you downloaded that Jamie linked you to above. Modify it to point to the proper path for Perl.

does this look correct as I am unsure: /usr/lib/x86_64-linux-gnu/perl5/5.30/

No, it’s just /usr/bin/perl. Just do which perl to get your system to tell you the path of any command.

ok great.

so I execute the command and get this response now:

image

I also added it to bootup action and i get the same prompt again: Warning! Your system’s primary IP address appears to have changed from…

At boot time, you need to run it as virtualmin modify-all-ips --default-old-ip --detect-new-ip

So I set it to run at boot time via ‘bootup and shutdown’ actions, rebooted…and it didnt work as the changed IP prompt was still there. When I execute it manually it works see below screenshot::

Any idea why it wont execute at boot?

Could this not be added as a menu option rather than a command to call a script for the next virtualmin release?

@mrfu510n88

Hi just use bash script it’s free. You’re Sysadmin right?

Can you capture the output from the script when you run it at boot time?

How do I do that through webmin?

In the bootup action you create to run this command, make the command something like :

virtualmin modify-all-ips --default-old-ip --detect-new-ip >/tmp/modify-ips.out 2>&1

Then check the contents of /tmp/modify-ips.out after rebooting.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.