To run a script during the startup of an OpenVZ container, you need to create a startup script in the appropriate directory. Here are the steps on how to do it:
1. First, you should identify the ID of your OpenVZ container. You can do this by running the command `vzlist -a` in the host server.
1. Once you’ve identified the ID, navigate to the config directory of your container which is usually `/etc/vz/conf`. Inside this directory, there should be a configuration file for each of your containers. The filename would be something like `CTID.conf`.
1. Now you need to create a startup script for your container. The startup script needs to be named `CTID.mount` and should be placed under `/etc/vz/conf`. Replace `CTID` with ID of your container.
1. In your startup script, you can include whatever commands you want to run during the startup of your container. Make sure that the commands are written in a bash script format.
1. Once you’ve made your script, give it execute permissions by running the command `chmod +x CTID.mount`.
1. To make sure that your script runs every time the container is started, you may want to add a line in your container’s config file (CTID.conf) that points to your startup script. You can do this by adding this line: `#!/bin/sh`.
1. That’s it! The next time you start your container using `vzctl start CTID`, your startup script will run.
Remember to replace `CTID` with your actual container ID.