Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UNRAID] Task Scheduler inside the container? Shell is immediately closing. #105

Open
Breakingx opened this issue Mar 12, 2024 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@Breakingx
Copy link

Breakingx commented Mar 12, 2024

Hello!

I stumbled upon this project by accident and am absolutly in love. Lidarr was extremly behind the releases of my favorite artist and deemon is just doing it's job.

My OS is Unraid. After setting everything up I noticed that the shell is closing instantly with the only output: "Container 1238012bdfsdf not running" -> something like that. So I wasn't able to add downloads or monitor artists.

I had to put the command "python3 -m deemon monitor X, Y, Z" inside the post arguments and had to restart the container for each command. That's okay. The process was easy: Monitor artists, Download Artists

But now I'm thinking about refreshing and downloading new releases. You mention in you documentation to run a cron job; but for unraid that's not possible. AFAIK you can't run and close dockers on schedules.

So my question is, if it would be possible to add a feature that runs inside the container that runs the jobs?

Best regards.

@digitalec
Copy link
Owner

@Breakingx I won’t lie, this is a great feature suggestion. However, I’m not very familiar with building docker containers. If someone more familiar is interested in getting this done, I’m open to PRs.

@digitalec digitalec added the help wanted Extra attention is needed label Mar 13, 2024
@digitalec
Copy link
Owner

I've looked into this a bit more and have gotten more familiar with building Dockerfiles/containers. Containers are intended to run one application and then exit when finished. This request would require the addition of something such as supercronic to run in the foreground, calling deemon to run a schedule. I'm not opposed to this, if that's what everyone wants, but it would be a big difference from the current implementation.

I guess what I'm saying is that if people want this change implemented, let me know here.

@relink2013
Copy link

But now I'm thinking about refreshing and downloading new releases. You mention in you documentation to run a cron job; but for unraid that's not possible. AFAIK you can't run and close dockers on schedules.

Fellow Unraid user here, you absolutely can Schedule the container and pass the commands to run on a schedule.

Go to the "Apps" tab and search for a plugin called "User Scripts". Once installed you'll find it under "Settings" toward the bottom.

In here you can add shell scripts and set schedules, or to even run on boot, shutdown, array start/stop, etc. Or you can use a custom Cron Schedule too right form the UI. This script should get you up and running, just make sure demix is already running.

#!/bin/bash

# echo "Checking Permissions..."
# chown -R 99:100 /mnt/user/MUSIC
# chmod -R 777 /mnt/user/MUSIC

echo "Starting deemon refresh"

docker run --name deemon \
 	--rm \
     -v /mnt/user/appdata/deemon:/config \
     -v /mnt/user/Media_Library/library/music/Deemix:/downloads \
     -v /mnt/system-nvme/appdata/Deemix-revived:/deemix \
      ghcr.io/digitalec/deemon:latest \
      python3 -m deemon refresh
                       
# echo "Checking Permissions..."
# chown -R 99:100 /mnt/user/MUSIC
# chmod -R 777 /mnt/user/MUSIC

echo "All Done!"

My library is managed by several other scripts so I added the parts that modify the permissions for my needs, but I figured I'd include it anyway in-case you need it. I have it commented out, so it won't run that portion by default.

Oh, and after you set your schedule, make sure to click "Apply" at the bottom of the list of scripts. Almost 7 years with Unraid and I still forget to click Apply sometimes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants