3 # This script is executed when a guest agent receives fsfreeze-freeze and
4 # fsfreeze-thaw command, if it is specified in --fsfreeze-hook (-F)
5 # option of qemu-ga or placed in default path (/etc/qemu/fsfreeze-hook).
6 # When the agent receives fsfreeze-freeze request, this script is issued with
7 # "freeze" argument before the filesystem is frozen. And for fsfreeze-thaw
8 # request, it is issued with "thaw" argument after filesystem is thawed.
10 LOGFILE
=/var
/log
/qga-fsfreeze-hook.log
11 FSFREEZE_D
=$
(dirname -- "$0")/fsfreeze-hook.d
13 # Check whether file $1 is a backup or rpm-generated file and should be ignored
16 *~ |
*.bak |
*.orig |
*.rpmnew |
*.rpmorig |
*.rpmsave |
*.sample
)
22 # Iterate executables in directory "fsfreeze-hook.d" with the specified args
23 [ ! -d "$FSFREEZE_D" ] && exit 0
24 for file in "$FSFREEZE_D"/* ; do
25 is_ignored_file
"$file" && continue
26 [ -x "$file" ] ||
continue
27 printf "$(date): execute $file $@\n" >>$LOGFILE
28 "$file" "$@" >>$LOGFILE 2>&1
30 printf "$(date): $file finished with status=$STATUS\n" >>$LOGFILE