Hello everyone!
I am currently running a script I got from another member (pasted below) while plotting, but I was wondering if there was a way to adjust it to copy to multiple destination directories instead of just 1. For example, I would like to fill 3 HDD’s at a time, so either a script that can alternate the HDD’s it copies to one at a time (HDD1 then HDD2 then HDD3), or switches to another HDD once one is full. Either one would work fine for me, I just want to be able to copy to multiple HDD’s so I don’t have to manually switch the script daily.
Any help would be greatly appreciated!
#!/bin/bash
# Watches for newly created plots and moves them to farmer 1 by 1.
# Requires inotify-tools: sudo apt-get install -y inotify-tools
# Directory paths
SRCDIR="/mnt/nvme1/"
DESTDIR="/mnt/storage/poolplots/"
# Limit transfer speed to minimise long lookup times whilst farming.
BWLIMIT="140000"
echo "Watching for new plots in: $SRCDIR"
echo "Copying plots to: $DESTDIR"
inotifywait -m $SRCDIR -e create -e moved_to |
while read path action file; do
if [[ "$file" =~ .*plot$ ]]; then
echo "Found new plot!"
echo "Copying plot to $DESTDIR"
rsync --bwlimit="$BWLIMIT" --preallocate --remove-source-files --skip-compress=plot --whole-file -avP "$SRCDIR/$file" "$DESTDIR/$file"
echo -e "Copy complete, waiting for new plots...\n"
fi
done