OpenVZ Forum


Home » Mailing lists » Devel » [WISH] exec early script at start
Re: [vzctl] exec early script at start [message #26152 is a reply to message #26038] Wed, 16 January 2008 10:22 Go to previous messageGo to previous message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

Yoann Moulin wrote:
> Kir Kolyshkin a écrit :
>> Technically, if you want to do something before vzctl start executes,
>> the way to go would be to write a simple shell wrapper which will do
>> what's needed and then run vzctl. Something like this:
>> <....skipped....>
> it was my first id, but I thought it wasn't compatible with reboot
> action (I saw today that reboot is done by cron which call vzctl).
In this case, rename vzctl to vzctl.real and put your wrapper script in
place of vzctl.
>
> So it's necessary to call that script vzctl or change the script call
> by  cron when a reboot is ask from a VE.
>
> But; is that compatible with "vzctl restart" ? I meant 'restart' can't
> be call, script must do a stop, execute some action, then do a start,
> so with that script 'restart' option for vzctl will be deprecated .
Right, here comes the problem.
>
> that's why I've decided to patch env.c because it's was the most
> transparency way to do what I want, without change anything in how
> vzctl works if the 'early_script.sh' doesn't exist.
Yeah, now I understand.

Have you tried using /etc/vz/conf/$VEID.start script? There are also
.stop, .mount and .umount. I'm sorry if it is not documented; will fix that.

Note that mount/umount scripts are both per-VE and global (global one is
called vps.mount/vps.umount), while start/stop are only per-VE. This can
easily be fixed: look at  src/lib/env.c, functions vps_start_custom()
and vps_stop() to see how start/stop scripts is called, then look at
src/lib/fs.c, functions vps_mount() and vps_umount() to see how both
global and per-VE mount/umount scripts are called. Now you can modify
code in env.c to have global start/stop scripts as well. Patches are
welcome.

PS the best way to do patches is to use git.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [RFC][-mm] Memory controller hierarchy support (v1)
Next Topic: To install OpenVZ in an Oracle installed system
Goto Forum:
  


Current Time: Tue Oct 15 19:04:43 GMT 2024

Total time taken to generate the page: 0.04892 seconds