etc/init.d/vz*: do not run stop inside a container

Apparently if /etc/init.d/vz script is (by mistake) run
inside a container, it leads to root fs unmounting and
killing all the processes inside that container.
Not a good thing to have, let's avoid that.

This commit adds a check for CT0 entry in /proc/user_beancounters,
which, naturally, only available in CT0. If there is no such entry
that means we are either in a container, or OpenVZ is not running.
In both cases we should not try to stop OpenVZ.

http://bugs.debian.org/597522
http://bugzilla.openvz.org/1655

Reported-by: Apollon Oikonomopoulos <apoikos@gmail.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
2 files changed