update rclone copy script

This commit is contained in:
2025-01-02 16:08:05 +00:00
parent a6c2119c78
commit f9b1d348b4

View File

@@ -207,11 +207,8 @@
name = "rclone-media";
runtimeInputs = [ pkgs.inotify-tools pkgs.libnotify pkgs.rclone ];
text = ''
inotifywait -mr \
--format '%w%f' \
-e close_write \
/mnt/HDD1/Videos/ |
while read -r file; do
function rclonecopy {
file=$1
changed_rel=''${file#"/mnt/HDD1/Videos"}
notify-send -a "rclone-media" "rclone for $file triggered"
if rclone copyto "$file" media:"media-7gM2gcrxRjXqfj$changed_rel" ; then
@@ -219,6 +216,14 @@
else
notify-send -u critical -a "rclone-media" "rclone failed for $file"
fi
}
inotifywait -mr \
--format '%w%f' \
-e close_write \
/mnt/HDD1/Videos/ |
while read -r file; do
rclonecopy "$file"
done
'';
}}/bin/rclone-media";