-
DocBlock started following Run unRAID on another Linux distro??
-
Pimp Your Rig
Very nice! When are you going to sell the plates to help offset those drives/controller cards?
-
Need a script to monitor a folder and copy it's contents
I puttered around a little bit this evening, and borrowing heavily from the mover script, I came up with this piece of code: #!/bin/bash # Author: DocBlock ([email protected]) # This is a rework of the unRAID mover script, designed to move completed files somewhere else # It arose as a request of another user on the unRAID forums. http://lime-technology.com/forum/index.php?topic=6350.0 # I did basic testing on this script, but that's all. If it breaks your server, you can keep both pieces. if [ -f /var/run/mymover.pid ]; then if ps h `cat /var/run/mymover.pid` | grep mymover.sh ; then echo "mymover already running, sorry." exit 0 fi fi echo $$ >/var/run/mymover.pid echo "Moving files from $1 to $2" (cd "$1"; find -depth -print \( ! -exec fuser -s '{}' \; -exec rsync -i -qdIWRpEAXogt --numeric-ids --inplace --remove-source-files {} "$2" \; \)) # Prune empty directories from source dir find "$1" -type d -empty -prune -exec rmdir --ignore-fail-on-non-empty {} \; # Prune empty directories from destination dir find "$2" -type d -empty -prune -exec rmdir --ignore-fail-on-non-empty {} \; sync rm /var/run/mymover.pid echo "Moving all done." I called it mymover.sh, and made it executable. Then, I created some test directories, that should match roughly what you're trying to do: torrentdisk `-- Completed Transfers |-- dir1 | `-- files1 |-- dir2 | `-- files2 `-- dir3 `-- not_done_writing disk1 `-- Completed Files Notice that I have some random mount point called torrentdisk, and it has some stuff in it. The file not_done_writing is still being copied in. I then run my script, as such: ./mymover.sh "/mnt/torrentdisk/Completed Transfers" "/mnt/disk1/Completed Files" And another look at the filesystem shows us this: torrentdisk `-- Completed Transfers `-- dir3 `-- not_done_writing disk1 `-- Completed Files |-- dir1 | `-- files1 `-- dir2 `-- files2 The files that aren't completed are still on the torrent disk, and completed files have been migrated to disk1. I think this is what you asked for. Best of luck! NOTE: The locations I used in this example are purely fictional. I'm still new to unRAID and I didn't go poke around enough to figure out where disks really get mounted, etc. You need to ensure the proper paths are supplied to the mymover.sh script.
DocBlock
Members
-
Joined
-
Last visited