improve overlap detection

This commit is contained in:
nachoparker 2018-11-10 23:42:00 -07:00
parent af2e599c8e
commit 21efd59959

View File

@ -111,13 +111,11 @@ ${DST_CMD[@]} true &>/dev/null || { echo "SSH access error to $NET. Do you have
# 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; }
ps -p "$( cat /run/btrfs-sync.pid 2>/dev/null )" &>/dev/null && { echo "$BIN is already running"; exit 1; }
pgrep -F /run/btrfs-sync.pid &>/dev/null && { echo "$BIN is already running"; exit 1; }
echo $$ > /run/btrfs-sync.pid
${DST_CMD[@]} "pgrep -f btrfs\ receive &>/dev/null" && { echo "btrfs-sync already running at destination"; exit 1; }
## src checks
echov "* Check source"
while read entry; do SRCS+=( "$entry" ); done < <(