Running regular background tasks on a network-attached storage (NAS) is an essential use case for backups, monitoring and more. With Synology DiskStations, there is an easy GUI-based approach to configure such tasks which still allows you to execute custom scripts.
First, navigate to Control Panel > Task Scheduler:
Select Create > Scheduled Task > User-defined Script:
Under “General Settings”, pick a proper name and select the job’s owner (this specifies the Linux system user which will execute the job):
Next, pick a schedule:
Finally, you need to specify the path to your user-defined script. You can either create it in the file manager or (the way I prefer), you can SSH into your DiskStation and edit the script directly. Make sure the job’s owner has the necessary permissions to access your script!
You can also provide an email address where the script’s output is sent to which is an excellent way to debug the script on first setup: