vserver Howto/FAQ

Howto index

Is it possible to execute some tasks when a vserver is started

The vserver utility checks if there is a file /etc/vservers/name.sh when it is operating a vserver called "name". This file is a script and is called in four case: Before starting a vserver, after, before stopping it and after. The first argument one of pre-start, post-start, pre-stop and post-stop. The second argument is the name of the vserver. A typical script looks like:

	#!/bin/sh
	case $1 in
	pre-start)
		mount --bind /home /vservers/$2/home
		;;
	post-start)
		;;
	pre-stop)
		;;
	post-stop)
		umount /vservers/$2/home
		;;
	esac