OpenVZ Forum


Home » Mailing lists » Devel » [WISH] exec early script at start
Re: [vzctl] exec early script at start [message #26038 is a reply to message #26031] Mon, 14 January 2008 21:29 Go to previous messageGo to previous message
Yoann Moulin is currently offline  Yoann Moulin
Messages: 16
Registered: December 2007
Junior Member
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:
> 
> #!/bin/sh
> ACTION=$1
> VEID=$2
> 
> start_actions() {
>    # put here all you need to do before vzctl start
> }
> 
> stop_actions() {
>    # same for stop
> }
> 
> case $ACTION in
>    start)
>       start_actions $*
>       ;;
>    stop)
>       stop_actions $*
>       ;;
>    # anything else you need here
> esac
> 
> # Finally, exec vzctl
> exec /usr/sbin/vzctl $*
> 
> Now, you just call the above script instead of calling vzctl directly. 
> You can even call the script 'vzctl', if you either put it into a 
> directory which is before /usr/sbin in your $PATH, or rename "real" 
> vzctl into something like vzctl.real.

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).

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 .

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.

Yoann
 
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 07 08:35:41 GMT 2025

Total time taken to generate the page: 0.13372 seconds