*SOLVED* How to execute scripts on vzctl start veid
What scripts would be called when a VE starts? Is the EXTERNAL_SCRIPT on vznet.conf the only one that would be called?
Re: How to execute scripts on vzctl start veid
For each VE you can use following action-scripts: <veid>.start <veid>.stop <veid>.mount <veid>.umount
For more details please look at OpenVZ User's Guide, pages 88-89 http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf
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.
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
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.