[Synology Download Station] Run filebot command only if there are new files
Posted: 22 Jan 2023, 07:56
e.g. find files in /volume1/complete that are less than 60 minutes old and larger than 100 megabytes:
-type f ... find files
-size +100M ... find files larger than 100 megabytes
-mmin -60 ... find files less than 60 minutes old
-quit ... quit with Exit Code 0 (i.e. SUCCESS) once a file has been found
e.g. bash script that will run filebot only if find found a recently modified large file:
If you are using Synology Download Station and want to process newly completed files near real-time (as opposed to running filebot once a day at midnight which is recommended) then you can use the find command (because find is very fast and lightweight) to quickly check if a filebot call is in order. You can then have Synology Task Scheduler run your task every hour to check for new files, and call filebot only if and when needed.
Code: Select all
find /volume1/complete -type f -size +100M -mmin -60 -print -quit
-size +100M ... find files larger than 100 megabytes
-mmin -60 ... find files less than 60 minutes old
-quit ... quit with Exit Code 0 (i.e. SUCCESS) once a file has been found
e.g. bash script that will run filebot only if find found a recently modified large file:
Code: Select all
if find /volume1/complete -type f -size +100M -mmin -60 -print -quit
then
filebot-node-task 0
fi
If you are using Synology Download Station and want to process newly completed files near real-time (as opposed to running filebot once a day at midnight which is recommended) then you can use the find command (because find is very fast and lightweight) to quickly check if a filebot call is in order. You can then have Synology Task Scheduler run your task every hour to check for new files, and call filebot only if and when needed.