blob: b6c2f848cca5cf48ed3e1e3f932af188001325f2 [file] [log] [blame] [raw]
#!/bin/sh
# Copyright (C) 2013, Parallels, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Resume a container using CRIU (http://criu.org).
# Useful with recent upstream (i.e. non-OpenVZ) kernels.
# Requires criu to be installed.
#
# Parameters are passed in environment variables.
# Required parameters:
# VE_ROOT - container root directory
# VE_DUMP_DIR - directory for saving dump files
# VE_STATE_FILE - file to write CT init PID to
exec 1>&2
. @SCRIPTDIR@/vps-functions
vzcheckvar VE_ROOT
vzcheckvar VE_STATE_FILE
vzcheckvar VE_DUMP_DIR
criu restore --file-locks \
--tcp-established \
--evasive-devices \
--link-remap \
--root $VE_ROOT \
--restore-detached \
-D $VE_DUMP_DIR \
-o restore.log \
-vvvv \
--pidfile $VE_STATE_FILE
if [ $? -eq 0 ]; then
rm -rf $VE_DUMP_DIR
else
echo The restore log was saved in $VE_DUMP_DIR/restore.log
exit 1
fi