OpenVZ VM First Boot Setup Tips: Difference between revisions

From Proxmox VE
Jump to navigation Jump to search
(Created page with "If we copy over a setup script into a VM Template during it's build, we can execute it on first boot up of it's newly created VM and on script completion we can remove the script…")
 
No edit summary
Line 3: Line 3:
Here are some bash shell script statements that perform some common tasks that may be used in such a script (the value will be placed in a variable for example '''VAR''' and it can be used with '''${VAR}''' in the scripts):
Here are some bash shell script statements that perform some common tasks that may be used in such a script (the value will be placed in a variable for example '''VAR''' and it can be used with '''${VAR}''' in the scripts):


Obtain the current IP of the container:
====Current IP of the container====
  MYIP=`ifconfig venet0:0 | grep "inet" | cut -d":" -f 2 | cut -d " " -f 1`
  MYIP=`ifconfig venet0:0 | grep "inet" | cut -d":" -f 2 | cut -d " " -f 1`
Obtain the Fully Qualified Domain Name of the container:
====Fully Qualified Domain Name of the container====
  FQDNAME=`hostname`.`dnsdomainname`
  FQDNAME=`hostname`.`dnsdomainname`




[[Category: HOWTO]]
[[Category: HOWTO]]

Revision as of 05:26, 10 October 2010

If we copy over a setup script into a VM Template during it's build, we can execute it on first boot up of it's newly created VM and on script completion we can remove the script and hence prevent it from running on subsequent boot ups.

Here are some bash shell script statements that perform some common tasks that may be used in such a script (the value will be placed in a variable for example VAR and it can be used with ${VAR} in the scripts):

Current IP of the container

MYIP=`ifconfig venet0:0 | grep "inet" | cut -d":" -f 2 | cut -d " " -f 1`

Fully Qualified Domain Name of the container

FQDNAME=`hostname`.`dnsdomainname`