--- vzctl-3.0.24.orig/etc/init.d/vz-redhat.in
+++ vzctl-3.0.24/etc/init.d/vz-redhat.in
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Copyright (C) 2000-2009, Parallels, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
@@ -25,10 +25,10 @@
### BEGIN INIT INFO
# Provides: vz
-# required-start: $network $remote_fs $syslog
-# required-stop: $network $remote_fs $syslog
-# Should-Start: sshd
-# Should-Stop: sshd
+# Required-start: $network $remote_fs $syslog
+# Required-stop: $network $remote_fs $syslog
+# Should-Start: sshd vzeventd
+# Should-Stop: sshd vzeventd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OpenVZ startup script
@@ -38,19 +38,12 @@
# This line is needed to cheat /etc/init.d/rc who expects action word
-VZCONF=@PKGCONFDIR@/vz.conf
-
-[ -f ${VZCONF} ] || exit 0
-. ${VZCONF}
-[ "${VIRTUOZZO}" = "no" ] && exit 0
-
-VZCTL=@SBINDIR@/vzctl
-[ -x ${VZCTL} ] || exit 0
+. @VZLIBDIR@/initd-functions
VZQUOTA=@SBINDIR@/vzquota
CONFIG_DIR=@PKGCONFDIR@/conf
-LOCKFILE=/var/lock/subsys/vz_lock
-SUBSYS_VZ=/var/lock/subsys/vz
+LOCKFILE=$VARLOCK/vz_lock
+SUBSYS_VZ=$VARLOCK/vz
VESTAT=/proc/vz/vestat
VZDEV=venet0
PRELOAD_MODULES=
@@ -78,25 +71,6 @@
fi
-rc_done='..done'
-rc_failed='..failed'
-# Source function library.
-if [ -r /etc/init.d/functions ]; then
- source /etc/init.d/functions
- if [ -r /etc/redhat-release ] || [ -r /etc/centos-release ]; then
- DISTR=redhat
- fi
-elif [ -r /etc/rc.status ]; then
- source /etc/rc.status
- if [ -r /etc/SuSE-release ]; then
- DISTR=suse
- fi
-elif [ -r /etc/debian_version ]; then
- DISTR=debian
- LOCKFILE=/var/lock/vz_lock
- SUBSYS_VZ=/var/lock/vz
-fi
-
VEINFO=""
RETVAL=0
# Number of the containers to stop in parallel.
@@ -104,84 +78,6 @@
PARALLEL=
cd /
-# We used to install OpenVZ cron job when the vzctl package was
-# installed, irrespective of whether OpenVZ was actually being
-# run. Although the cron jobs didn't create any problems if someone
-# wasn't running OpenVZ some users complained about the cron log file
-# filling up, resource usage, and power consumption since systems
-# wouldn't really idle. It really only makes sense to run the OpenVZ
-# cron job if the vz service is turned on and not just merely
-# having the package installed. This init.d script is an obvious place
-# to install or remove the cron jobs based on the service
-# being enabled or not.
-SRC_CRONSCRIPT_DIR=@CRONDDIR@
-DST_CRONSCRIPT_DIR=@DST_CRONDDIR@
-
-check_old_cron_files()
-{
- # avoid double OpenVZ cron settings
- local f
- for f in vpsreboot vpsnetclean; do
- [ -f $DST_CRONSCRIPT_DIR/$f ] && rm -f $DST_CRONSCRIPT_DIR/$f
- done
-}
-
-if ! type is_ignored_file >/dev/null 2>&1; then
- is_ignored_file() {
- case "$1" in
- *~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave)
- return 0
- ;;
- esac
- return 1
- }
-fi
-
-setup_cron()
-{
- local f ch
-
- check_old_cron_files
- [ -z "$SRC_CRONSCRIPT_DIR" ] && return
- [ -d "$SRC_CRONSCRIPT_DIR" ] || return
- [ -d "$DST_CRONSCRIPT_DIR" ] || return
- for f in $SRC_CRONSCRIPT_DIR/vz*; do
- if ! is_ignored_file $f; then
- cat $f > $DST_CRONSCRIPT_DIR/vz && ch=yes
- fi
- done
- [ $ch = 'yes' ] && chmod 644 $DST_CRONSCRIPT_DIR/vz
-}
-
-remove_cron()
-{
- check_old_cron_files
- [ -z "$SRC_CRONSCRIPT_DIR" ] && return
- [ -d "$SRC_CRONSCRIPT_DIR" ] || return
- [ -d "$DST_CRONSCRIPT_DIR" ] || return
- cat > $DST_CRONSCRIPT_DIR/vz <<EOF
-# DO NOT EDIT THIS FILE!
-#
-# Contents of this file managed by /etc/init.d/vz script
-# Master copy is in $SRC_CRONSCRIPT_DIR/vz* file(s).
-# Consult $SRC_CRONSCRIPT_DIR/vz* for documentation.
-EOF
-}
-
-# Actualize OpenVZ cron entry:
-# if OpenVZ is running, add it, otherwise remove.
-update_cron()
-{
- if is_running; then
- __echo "Adding OpenVZ cron entries"
- setup_cron
- else
- __echo "Removing OpenVZ cron entries"
- remove_cron
- fi
- print_result
-}
-
check_kernel()
{
if ! test -d /proc/vz ; then
@@ -250,58 +146,6 @@
return 0
}
-print_success()
-{
- if [ "$DISTR" = "redhat" ]; then
- echo_success
- else
- echo -n "$rc_done"
- fi
- echo
-}
-
-print_failure()
-{
- echo -n "$1"
- if [ "$DISTR" = "redhat" ]; then
- failure $"$1"
- else
- echo -n "$rc_failed"
- fi
- echo
-}
-
-print_warning()
-{
- if [ "$DISTR" = "redhat" ]; then
- echo -n "$1"
- warning $"$1"
- else
- echo -n "- Warning: $1 "
- fi
- echo
-}
-
-# Calls either print_success or print_failure, depending on $?
-# Optional argument $1 -- an error string passed to print_failure.
-print_result()
-{
- if [ $? -eq 0 ] ; then
- print_success
- else
- print_failure "$1"
- fi
-}
-
-__echo()
-{
- if [ "$DISTR" = "redhat" ]; then
- echo -n $"$1"
- else
- echo -n "$1"
- fi
-}
-
is_running()
{
get_veinfo || return 1
@@ -570,7 +414,6 @@
start_net
setup_ve0
- setup_cron
start_ves
rm -f $LOCKFILE
@@ -589,7 +432,6 @@
fi
stop_ves
- remove_cron
stop_net
__echo "Stopping OpenVZ: "
for mod in ${MODULES_OTHER} ${MODULES} ${PRELOAD_MODULES} ${IPT_MODULES} ${VZFS_MODULES}; do
@@ -629,12 +471,8 @@
status
RETVAL=$?
;;
- update-cron)
- update_cron
- RETVAL=0
- ;;
*)
- echo "Usage: $0 {start|stop|status|restart|force-reload|update-cron}"
+ echo "Usage: $0 {start|stop|status|restart|force-reload}"
exit 1
esac