forked from evolix/evobackup
bkctld-inc: add locks to btrfs actions
It's probably useless since btrfs commands return almost instantly but it's consistent with ext4 commands.
This commit is contained in:
parent
f6665c646b
commit
6377ffd09e
|
@ -14,7 +14,16 @@ create_inc_btrfs() {
|
||||||
jail_path=$(jail_path "${jail_name}")
|
jail_path=$(jail_path "${jail_name}")
|
||||||
inc_path=$(inc_path "${jail_name}" "${inc_name}")
|
inc_path=$(inc_path "${jail_name}" "${inc_name}")
|
||||||
|
|
||||||
|
# The lock file prevents from starting a new copy when one is already being done
|
||||||
|
lock_file="${LOCKDIR}/inc-${jail_name}-${inc_name}.lock"
|
||||||
|
if [ -f "${lock_file}" ]; then
|
||||||
|
warning "${jail_name}: skipping '${inc_name}', it is already being created."
|
||||||
|
else
|
||||||
|
(
|
||||||
start=$(current_time)
|
start=$(current_time)
|
||||||
|
mkdir --parents "${LOCKDIR}" && touch "${lock_file}"
|
||||||
|
# shellcheck disable=SC2064
|
||||||
|
trap "rm -f ${lock_file}" 0
|
||||||
|
|
||||||
if dry_run; then
|
if dry_run; then
|
||||||
echo "[dry-run] btrfs subvolume snapshot of ${jail_path} to ${inc_path}"
|
echo "[dry-run] btrfs subvolume snapshot of ${jail_path} to ${inc_path}"
|
||||||
|
@ -26,6 +35,8 @@ create_inc_btrfs() {
|
||||||
|
|
||||||
end=$(current_time)
|
end=$(current_time)
|
||||||
notice "${jail_name}: inc '${inc_name}' has been created [${start}/${end}]"
|
notice "${jail_name}: inc '${inc_name}' has been created [${start}/${end}]"
|
||||||
|
)
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
create_inc_ext() {
|
create_inc_ext() {
|
||||||
jail_name=$1
|
jail_name=$1
|
||||||
|
|
Loading…
Reference in a new issue