Create /reboot if running inside OpenVZ, #138.

This should be fine as vpsreboot should only restart a stopped container.
This commit is contained in:
Roy Marples 2009-02-10 15:06:48 +00:00
parent 6bb44be2a3
commit 3d7b56f2e2

View File

@ -29,7 +29,7 @@ cleanup_tmp_dir()
if yesno ${wipe_tmp:-${WIPE_TMP:-yes}}; then if yesno ${wipe_tmp:-${WIPE_TMP:-yes}}; then
ebegin "Wiping ${dir} directory" ebegin "Wiping ${dir} directory"
local startopts="-x . -depth" local startopts="-x . -depth"
[ "${RC_UNAME}" = "Linux" ] && startopts=". -xdev -depth" [ "${RC_UNAME}" = Linux ] && startopts=". -xdev -depth"
# Faster than find # Faster than find
rm -rf -- [b-ikm-pr-zA-Z0-9\.]* rm -rf -- [b-ikm-pr-zA-Z0-9\.]*
@ -131,7 +131,7 @@ start()
if ${logw} || dir_writeable /var/log; then if ${logw} || dir_writeable /var/log; then
# Create an 'after-boot' dmesg log # Create an 'after-boot' dmesg log
if [ "${RC_SYS}" != "VSERVER" -a "${RC_SYS}" != "OPENVZ" ]; then if [ "${RC_SYS}" != VSERVER -a "${RC_SYS}" != OPENVZ ]; then
dmesg > /var/log/dmesg dmesg > /var/log/dmesg
chmod 640 /var/log/dmesg chmod 640 /var/log/dmesg
fi fi
@ -144,9 +144,10 @@ start()
stop() stop()
{ {
# Write a halt record if we're shutting down # Write a halt record if we're shutting down
case "${RC_RUNLEVEL}" in if [ "${RC_RUNLEVEL}" = shutdown ]; then
reboot|shutdown) [ "${RC_UNAME}" = "Linux" ] && halt -w;; [ "${RC_UNAME}" = Linux ] && halt -w
esac [ "${RC_SYS}" = OPENVZ ] && printf "" >/reboot
fi
return 0 return 0
} }