SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

Monitor Watch Folder on Docker startup

I’m using the SongKong docker in Unraid and I’d like to start monitoring a watched folder as soon as the docker starts. I found “songkongremote.sh” in the container but not “songkong.sh”. Is it possible to do this? Thanks

So you want to run SongKong with the -w option rather than start on remote mode. If you did this you would only see output on the command line, you would not be able to monitor via web browser so I’m not sure that works for you.

If it does work for you then how do I achieve in docker, it seems the end point would have to be a command whereby you could run your command that would not be so user friendly for others.

Or are you suggesting you build another docker based on my docker but you need me to make songkong.sh available for you ?

I should say I don’t really have a preference for how it should work, I would just like some way for SongKong to begin monitoring a watched folder on startup. As I understand it, I would have to manually start the monitor any time the docker restarts. I brought up the -w option because I couldn’t figure out a way to achieve this with the remote web remote. Maybe it already is possible?

As for achieving it through the official docker, Unraid can add “Post Arguments” to the docker exec command. Would something like this be possible?

#pseudocode
if (no argument provided):
    #run SongKong as remote, as it works now
    #this could also be the default in the Unraid template, with no additional "Post Arguments"
else if (watch command + watch path):
    #automatically start docker monitoring the watch path
    #if this is only possible with songkong.sh, and means no web browser, that's fine
else if (fix songs command + path):
    #allows single execution on demand
else if (delete duplicates command + path):
    #allows single execution on demand

Thanks!

Okay Keith it would certainly be possible for you to create a slightly modified version of docker that ran watch folder with a particular folder. It will probably be possible for me to do something like you suggest but I would have to do research by Docker knowledge is limited, and Im not clear if Post Arguments can only be used on unraid or if equivalent can be done with standard Docker.

These solutions wont provide remote interface as you will be using cmd line interface (precursor to remote interface). I suppose the ultimate solution would be to add an option to Watch Folder to start automatically with selected folder so it could be configured with Remote UI, but that would require programming effort.

So is it worth it ?

I am not clear, are you expecting your machine to reboot often , is this part of particular workflow or just you protecting yourself from a task if a rare unexpected reboot occurs (i.e power cut)

Sorry for the delayed response.

I believe if you added songkong.sh to the official docker it would be the simplest way to add the functionality I’m looking for. If there is some reason you’d rather not add it, then yes I’d appreciate if you could send me the file and I’ll try creating my own docker.


Unraid’s post arguments are simply arguments added to the end of the docker run command when starting up a container:

docker run -d --name='songkong' 'songkong/songkong' {{POST_ARGUMENTS}}

I should be able use them to execute docker run ... ./songkong.sh -w /path/to/watch


Just adding the songkong.sh should do the trick, but if you’re curious about the Docker stuff, this article Docker CMD Vs ENTRYPOINT was helpful. To sum it up:

  • Use ENTRYPOINT in the Dockerfile to specify an executable/arguments that will always run, even if additional arguments are added to the docker run command

    • Techinically always, but --entrypoint can be added to docker run to override entrypoint specified in Dockerfile
  • Use CMD in the Dockerfile to specify default executable/arguments but they will not be used if arguments are added to the docker run command

I’m happy to add songkong.sh if it would help, I’ll try and get something in for new release due this week or next.

Okay with some help I now have a working solution that will be available in SongKong 6.10 very soon.

Now available in SongKong 6.10 - details at How to run SongKong cmdline with Docker

1 Like

This is great and works perfectly! Thanks so much for adding this functionality!

1 Like

Hi paul… we talked a long time ago and I did this.

What I did was that I set up a docker container, setup the environment (putting .songkong in the right place, etc), other deps, and set the settings to a fixed folder /in and /out.

With docker, you mount the volumes to that location. Execute songkong headless, and you’re good to go.