User`s guide
Reference 88
Overview
Along with OpenVZ configuration files responsible for the OpenVZ system configuration, there
are a number of OpenVZ scripts allowing you to customize the VPS behaviour in different
ways. These are the following scripts:
Script Name Description
/etc/sysconfig/vz-
scripts/
VPS_ID.action
VPS private action scripts. These scripts allow to run user-
defined actions on particular events. Currently defined
actions are
start, stop, mount, umount.
/var/lib/vzctl/scripts/…
Scripts to be executed on performing certain VPS-related
operations (e.g. on adding a new IP address to the VPS).
These operations should be specified in the corresponding
distribution configuration file.
/etc/rc.d/init.d/vz
OpenVZ start/stop System V script. This script is
responsible for proper OpenVZ startup and shutdown
procedures, including OpenVZ modules loading and VPS
start/stop procedures.
OpenVZ Action Scripts
There might be situations when you need to do additional actions when a particular VPS is
started or stopped. For example, if you want to be able to access the Host OS file system (or part
of it) from VPS 101, then you can bind mount it inside the VPS manually from the Host OS.
However, after you restart the VPS, your mount disappears, and you should manually type the
mount command again.
OpenVZ allows you to automate procedures like the above by using OpenVZ action scripts.
There are six action scripts defined in this version of OpenVZ:
global
mount
This script runs immediately after vzctl mounts the VPS private area. The VPS itself is
not yet running and the script is running in the Host OS context.
mount
This script runs immediately after the global mount script. The VPS is still not running, and
the scripts is called in the Host OS context.
start
After vzctl has started a VPS, it runs the VPS start script. The script is running already
in the VPS context.
stop
This script runs before the VPS is stopped, in the VPS context.
umount
After the VPS has been already stopped, the umount script is executed, and the script runs
in the Host OS context.
global
umount
This script runs when vzctl is about to dismount the VPS private area. It also runs in the
Host OS context.