prevent overlap with other btrfs-sync instances

This commit is contained in:
nacho 2018-04-27 12:43:32 +02:00
parent d9aca00f8c
commit 36c05dc9e8

View File

@ -58,7 +58,7 @@ chmod +x /etc/cron.daily/btrfs-sync
"
}
echov() { [[ "$VERBOSE" == 1 ]] && echo "$@" || true; }
echov() { if [[ "$VERBOSE" == 1 ]]; then echo "$@"; fi }
#----------------------------------------------------------------------------------------------------------
@ -105,6 +105,11 @@ ${DST_CMD[@]} true &>/dev/null || { echo "SSH access error to $NET"; exit 1; }
# more checks
## don't overlap
[[ "$SSH" != "" ]] && NUM_PS=0 || NUM_PS=2
${DST_CMD[@]} "[[ \$( pgrep -c \"btrfs-sync\" ) -ne $NUM_PS ]]" \
&& { echo "btrfs-sync already running at destination"; exit 1; }
## src checks
while read entry; do SRCS+=( "$entry" ); done < <(
for s in "${SRC[@]}"; do