blob: 5f8f8abccdf7d29eb6a19ff0b2d108d4d328c14c [file] [log] [blame] [raw]
#!/sbin/runscript
depend() {
use net
before vz
}
check_config() {
source /etc/conf.d/vz
# if we don't want openvz running, say so
[ "${VIRTUOZZO}" = "yes" ] || return 1
: ${VZEVENTD:=@SBINDIR@/vzeventd}
}
load_module() {
if [ "${MODULES_DISABLED}" != "yes" ]; then
local rv=0
ebegin "Loading vzevent module"
modprobe -r vzevent >/dev/null 2>&1
modprobe vzevent reboot_event=1 >/dev/null 2>&1
rv=$?
if [ ${rv} -ne 0 ]; then
eend ${rv}
return ${rv}
fi
fi
local param=/sys/module/vzevent/parameters/reboot_event
if ! grep -Fqw 1 "${param}"; then
ewarn "vzevent module should be loaded with reboot_event=1 parameter"
ewarn "setting reboot_event to 1..."
ewarn "echo 1 > ${param}"
echo 1 > "${param}"
fi
return 0
}
start() {
[ -d /proc/vz ] || return
check_config || return
load_module || return
ebegin "Starting vzeventd"
start-stop-daemon --start --exec ${VZEVENTD} \
--pidfile /var/run/vzeventd.pid \
-- ${VZEVENTD_OPTS}
eend $?
}
stop() {
check_config || return
ebegin "Stopping vzeventd"
start-stop-daemon --stop --exec ${VZEVENTD} \
--pidfile /var/run/vzeventd.pid
eend $?
}