OpenVZ Forum


Home » General » Support » *SOLVED* How to execute scripts on vzctl start veid
*SOLVED* How to execute scripts on vzctl start veid [message #15013] Mon, 16 July 2007 21:29 Go to next message
ggonzalez is currently offline  ggonzalez
Messages: 18
Registered: July 2007
Junior Member
What scripts would be called when a VE starts?

Is the EXTERNAL_SCRIPT on vznet.conf the only one that would be called?

[Updated on: Tue, 17 July 2007 08:34] by Moderator

Report message to a moderator

Re: How to execute scripts on vzctl start veid [message #15019 is a reply to message #15013] Tue, 17 July 2007 07:27 Go to previous messageGo to next message
vaverin is currently offline  vaverin
Messages: 708
Registered: September 2005
Senior Member
For each VE you can use following action-scripts:
<veid>.start
<veid>.stop
<veid>.mount
<veid>.umount
Re: How to execute scripts on vzctl start veid [message #15020 is a reply to message #15019] Tue, 17 July 2007 07:34 Go to previous messageGo to next message
vaverin is currently offline  vaverin
Messages: 708
Registered: September 2005
Senior Member
For more details please look at OpenVZ User's Guide, pages 88-89
http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf

[Updated on: Tue, 17 July 2007 07:34]

Report message to a moderator

Re: How to execute scripts on vzctl start veid [message #15050 is a reply to message #15020] Tue, 17 July 2007 16:17 Go to previous messageGo to next message
ggonzalez is currently offline  ggonzalez
Messages: 18
Registered: July 2007
Junior Member
The manual says these action scripts are located in /etc/sysconfig/vz-scripts.

On debian, are they to be located in /etc/vz/conf?

Pardon my ignorance, but how is it that a mount script is executed before de VE starts? That is, how is it that these mounts are handled/available to the VE if the VE did not start yet?

What can be accomplished by a VE start script, that is executed before any VE init scripts? (what is the idea).

If there is a need to call scripts AFTER the VE is fully initialized (from the HN), the only option now is the vznet.conf EXTERNAL_SCRIPT, right?

Thanks for being very cooperative, and excuse me if I am asking dummy questions.

Regards,
Gustavo.

Re: How to execute scripts on vzctl start veid [message #15063 is a reply to message #15050] Wed, 18 July 2007 02:18 Go to previous messageGo to next message
vaverin is currently offline  vaverin
Messages: 708
Registered: September 2005
Senior Member
Hi Gustavo.

ggonzalez wrote on Tue, 17 July 2007 20:17

The manual says these action scripts are located in /etc/sysconfig/vz-scripts.

On debian, are they to be located in /etc/vz/conf?


IMHO it is the same directory, /etc/vz/conf uses symlinks

ggonzalez wrote on Tue, 17 July 2007 20:17

Pardon my ignorance, but how is it that a mount script is executed before de VE starts? That is, how is it that these mounts are handled/available to the VE if the VE did not start yet?

What can be accomplished by a VE start script, that is executed before any VE init scripts? (what is the idea).



You cannot execute anything _before_ mount. To execute any scripts/binaries you need to read these files first, and to do it you need to mount according partition.

Let's look at hardware node: initrd mounts root partitions, procfs, sysfs, udev on the booting stage before any init scripts.

Mount-script for VE is something like initrd for Hardware node.
For VE we mounts its "/" by default, but when node admin wants to get access to external directories, it can do it by using mount-scripts.

ggonzalez wrote on Tue, 17 July 2007 20:17

If there is a need to call scripts AFTER the VE is fully initialized (from the HN), the only option now is the vznet.conf EXTERNAL_SCRIPT, right?


I'm not sure that understand you correctly: EXTERNAL_SCRIPT is executed to configure veth interface and on VE start it executed after <ve>.mount but before <ve>.start script.

However I do not think that using vznet.conf EXTERNAL_SCRIPT is good idea -- it executes not only on VE start but on _any_ veth re-configuration on live VE.

If you want to add something into VE from VE0 context -- please use <ve>.mount script. If you neet to execute something inside VE before initscripts -- please use <ve>.start script.

Is it not suitable for your purposes? In this case could you please explain, what do you means under "VE is fully initialized?". Is it when VE become accessible via network? Is it when last init-script inside VE has been finished?

If this event is after network initialization: you can write some client-server application: client inside VE will request any additional service and server in VE0 will handle these requests.

Thank you,
Vasily Averin
Re: How to execute scripts on vzctl start veid [message #15086 is a reply to message #15063] Wed, 18 July 2007 13:00 Go to previous message
ggonzalez is currently offline  ggonzalez
Messages: 18
Registered: July 2007
Junior Member
Vasily,

Quote:

IMHO it is the same directory, /etc/vz/conf uses symlinks


I checked this on Debian, and it is not a symlink, and the /etc/sysconfig directory does not exist.

The veid.start scritp has to be on /etc/vz/conf. I confirmed this.

Quote:

I'm not sure that understand you correctly: EXTERNAL_SCRIPT is executed to configure veth interface and on VE start it executed after <ve>.mount but before <ve>.start script.



Thanks for clarifying this. It should be on the OpenVZ Users Manual, for completeness.

Thanks again,

Gustavo.

Previous Topic: gateway - route
Next Topic: *SUCCESS* Centos 5 minimal template
Goto Forum:
  


Current Time: Mon Jun 17 19:33:06 GMT 2024

Total time taken to generate the page: 0.03730 seconds