Scheduling daily import on Synology

I’m wondering if there is a way to use synology’s task scheduler to run beets (which I have installed in a docker container) on a regular schedule, perhaps daily.

I’m not great with command line or scripting but can muddle my way through it. I just need a little direction.

I have a folder on my Synology NAS which contains newly downloaded music. I would like to automate the process of having beets tag and organize/move the files into my music library.

If you can schedule shell commands, you should be able to run an import with -q (quiet) to tell beets to import without asking for user input.

If you haven’t got beets set to move imported files, you’ll also want the -i (incremental) flag to tell beets to import only new items.

In quiet mode, beets will skip any import items which would normally require user input, but you can keep a log of these using -l path-to-log.

See the import section of the beets documentation (or run beet import -h) for a list of all available import options.

That’s very helpful, thank you! What would the shell command look like in the Synology task scheduler? Do I need a separate file for it to call or can I put the command directly in the task scheduler?

Also, is there a way to create something like a bookmark or shortcut on an Android device of from a browser to run an import like this with one click?

What would the shell command look like in the Synology task scheduler?

The command would just be whatever the normal docker command is you use to run a beets import (with the flags I mentioned above).

Do I need a separate file for it to call or can I put the command directly in the task scheduler?

I’m not all that familiar with Synology’s task scheduler, but from their documentation it seems like you can just put the command straight in the task scheduler itself (they seem to call it a “User-defined script” on this page).

Also, is there a way to create something like a bookmark or shortcut on an Android device of from a browser to run an import like this with one click?

Provided SSH access is enabled, you should be able to use something like this app (or any equivalent which allows running pre-defined commands over SSH using a shortcut) to just run the same import command you configured the scheduler to run.

Thanks! I’ll play around with it.

That SSH button looks cool. I’m not sure how secure it is to leave SSH on.

Not having any luck getting it to run. From the command line prompt I use these commands:

$ sudo -i docker exec -i -t beets bash
Password:

beet import -q /downloads/test

This successfully imports new music files from my “test” folder without prompting me (quiet mode). I have the log set in my config file.

It not clear to me how to do this in synology task scheduler.

Any luck at all here? I’m looking to do this too but trying to install another plugin before I look into to this further.

But by the looks of it, if you go into Control Panel > Task Scheduler (scroll all the way to the bottom) > Create > Scheduled Task > User-defined Script then you can firstly name the task and select what user activates the script - I would try using admin first, but perhaps root maybe needed.

Then use the Schedule tab to enter when and how often you want the script to run.

Then finally go to the Task Settings tab to enter the User Script. The example says: bash /volume1/public/job.sh

So this is just pointing to the script’s location that will be run, which will lead me on to my next bit of research of how to make the .sh file. Hoping it is just plain text with the normal Beets SSH command, if so then it should take no time to set up :slightly_smiling_face: