[Synology Download Station] Run filebot command only if there are new files

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

[Synology Download Station] Run filebot command only if there are new files

Post by rednoah »

e.g. find files in /volume1/complete that are less than 60 minutes old and larger than 100 megabytes:

Code: Select all

find /volume1/complete -type f -size +100M -mmin -60 -print -quit
-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:

Code: Select all

if find /volume1/complete -type f -size +100M -mmin -60 -print -quit
then
	filebot-node-task 0
fi



:idea: 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.
:idea: Please read the FAQ and How to Request Help.
Post Reply