mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
tmpfiles: implement user tmp files feature
Add new action script tmp-files.sh, which allows user to add files that can be lost between checkpoint and restore to the dump. User files are stored in .tar.gz archive. Tar command does all the file paths and attributes related work. Fixes #65 Signed-off-by: Svyatoslav Vlasov <svloyso@gmail.com> Signed-off-by: Eugene Batalov <eabatalov89@gmail.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
7f1a4a160a
commit
bb7d912e40
1 changed files with 47 additions and 0 deletions
47
scripts/tmp-files.sh
Executable file
47
scripts/tmp-files.sh
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Script allows to save arbitrary files in CRIU dump dir and properly restore
|
||||
# these files on CRIU restore cmd.
|
||||
#
|
||||
# Normally you need to call this script for files that can be lost between
|
||||
# CRIU checkpoint and restore cmds. For example for files stored on non-tmpfs
|
||||
# mount points. That's why this script is called tmp-files.
|
||||
#
|
||||
# You should call this script on both CRIU dump and restore cmds.
|
||||
#
|
||||
# Usage:
|
||||
# criu dump <options> --action-script \
|
||||
# '$CRIU_SCRIPTS_PATH/tmp-files.sh /tmp/ycm_temp /home/user/.tmpfile.txt.swp'
|
||||
# criu restore <options> --action-script $CRIU_SCRIPTS_PATH/tmp-files.sh
|
||||
#
|
||||
# Note: absolute path to tmp-files.sh should be supplied in --action-script with ''
|
||||
#
|
||||
|
||||
POSTDUMP="post-dump"
|
||||
PRERESTORE="pre-restore"
|
||||
DUMPARGS="--create --absolute-names --gzip --no-unquote --no-wildcards --file"
|
||||
RESTOREARGS="--extract --gzip --no-unquote --no-wildcards --absolute-names --directory / --file"
|
||||
IMGFILE=$CRTOOLS_IMAGE_DIR"/tmpfiles.tar.gz"
|
||||
|
||||
MY_NAME=`basename "$0"`
|
||||
|
||||
case "$CRTOOLS_SCRIPT_ACTION" in
|
||||
$POSTDUMP )
|
||||
if [ "$#" -lt 1 ]; then
|
||||
echo "$MY_NAME: ERROR! No files are given."
|
||||
exit 1
|
||||
fi
|
||||
tar $DUMPARGS $IMGFILE -- "$@"
|
||||
exit $?
|
||||
;;
|
||||
$PRERESTORE )
|
||||
if [ "$#" -ne 0 ]; then
|
||||
echo "$MY_NAME: ERROR! Not expected script args."
|
||||
exit 1
|
||||
fi
|
||||
tar $RESTOREARGS $IMGFILE
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue