server entry in the /etc/hosts

3 posts / 0 new
Last post
#1 Tue, 06/10/2008 - 01:57
zafar466

server entry in the /etc/hosts

Hello,

i am searching the way to handle virutalmin/webmin such that whenever i create a virtual server an entry is made in the /etc/hosts file and when the server is deleted the entry in the /etc/hosts file is deleted

i have been trying to change some code in the create-domain.pl scripts that are executed when a virtual server is created . but i have not been able to do that please give some help in this regard

Thanks.

Tue, 06/10/2008 - 13:42
Joe
Joe's picture

You don't need to modify Virtualmin code (and shouldn't, because it'll just get overwritten every time you upgrade). Virtualmin can execute scripts for you on creation and modification of virtual servers.

Look in Module Configuration in the "Actions upon server and user creation". You can write a script to update hosts, and use the VIRTUALSERVER_DOM to know the hostname and VIRTUALSERVER_IP to know the IP in your script. Other variables are available, see the help for those options. (The options are "Command to run before making changes to a server" and "Command to run after making changes to a server"...there are matching options for aliases, as well.)

--

Check out the forum guidelines!

Thu, 10/30/2008 - 02:35
VyouFinder

I am just cruious as to why you would want to modify the hosts file every time a new virtual server is added..?

Topic locked