update rclone copy script
This commit is contained in:
@@ -207,18 +207,23 @@
|
|||||||
name = "rclone-media";
|
name = "rclone-media";
|
||||||
runtimeInputs = [ pkgs.inotify-tools pkgs.libnotify pkgs.rclone ];
|
runtimeInputs = [ pkgs.inotify-tools pkgs.libnotify pkgs.rclone ];
|
||||||
text = ''
|
text = ''
|
||||||
|
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
|
||||||
|
notify-send -a "rclone-media" "rclone complete for $file"
|
||||||
|
else
|
||||||
|
notify-send -u critical -a "rclone-media" "rclone failed for $file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
inotifywait -mr \
|
inotifywait -mr \
|
||||||
--format '%w%f' \
|
--format '%w%f' \
|
||||||
-e close_write \
|
-e close_write \
|
||||||
/mnt/HDD1/Videos/ |
|
/mnt/HDD1/Videos/ |
|
||||||
while read -r file; do
|
while read -r file; do
|
||||||
changed_rel=''${file#"/mnt/HDD1/Videos"}
|
rclonecopy "$file"
|
||||||
notify-send -a "rclone-media" "rclone for $file triggered"
|
|
||||||
if rclone copyto "$file" media:"media-7gM2gcrxRjXqfj$changed_rel" ; then
|
|
||||||
notify-send -a "rclone-media" "rclone complete for $file"
|
|
||||||
else
|
|
||||||
notify-send -u critical -a "rclone-media" "rclone failed for $file"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
}}/bin/rclone-media";
|
}}/bin/rclone-media";
|
||||||
|
|||||||
Reference in New Issue
Block a user