2
# Copyright (C) 2000-2006 SWsoft. All rights reserved.
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
# Script to start VPS was rebooted
22
VZCONF=/etc/vz/vz.conf
24
VE_INFO=/proc/vz/veinfo
26
LOCKFILE='/var/lock/vereboot.lock'
28
[ -f ${VZCONF} ] || exit
31
function check_reboot()
38
[ -f "${CONF_DIR}/${veid}.conf" ] || return
41
. ${CONF_DIR}/${veid}.conf;
42
echo ve_root=${VE_ROOT}\;;
43
echo allowreboot=${ALLOWREBOOT}\;;
45
if [ ! -z "${allowreboot}" -a "x${allowreboot}" = "xno" ]; then
48
if [ -f "${ve_root}/${REBOOT_MARK}" ]; then
49
[ -z "${LOGFILE}" ] || echo "`date --iso-8601=seconds` vereboot : VPS ${veid} : reboot " >> ${LOGFILE}
50
/usr/sbin/vzctl start ${veid} >/dev/null 2>&1
56
local tmpfile="${LOCKFILE}.$$"
58
echo $$ > ${tmpfile} 2> /dev/null || exit
60
ln ${tmpfile} ${LOCKFILE} >& /dev/null && {
64
kill -0 `cat $LOCKFILE` >& /dev/null && {
68
ln ${tmpfile} ${LOCKFILE} >& /dev/null && {
72
rm -f ${LOCKFILE} ${tmpfile}
76
# If VZ is not running -- do nothing
77
# Fix for OpenVZ bug #107
78
test -f ${VE_INFO} || exit 0
81
cd ${CONF_DIR} 2>/dev/null || exit 0
82
VE_TOTAL=`ls -1 *.conf 2>/dev/null | sed s/.conf//`
83
VE_RUN=`cat ${VE_INFO} | awk '{
91
if [ -z "${VE_RUN}" ]; then
92
VE_STOPPED="${VE_TOTAL}"
94
VE_STOPPED=`echo -e "${VE_TOTAL}" | egrep -v "${VE_RUN}"`
97
for i in ${VE_STOPPED}; do