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

[Feature request] Automated Conversion triggered only within specified time range #340

Open
aronmgv opened this issue Apr 22, 2024 · 2 comments · May be fixed by #342
Open

[Feature request] Automated Conversion triggered only within specified time range #340

aronmgv opened this issue Apr 22, 2024 · 2 comments · May be fixed by #342

Comments

@aronmgv
Copy link

aronmgv commented Apr 22, 2024

Idea

Hello,

I would like to suggest to implement a way to specify time slot for automated conversions. I would desire it to be triggered only during night hours when I am not using the server for other activities..

Haven't seen this in documentation so I expect it is not possible at the moment.. Please let me know if it is something you can implement in your image.

Should be possible via CRON. I would like to see multiple CRON slots so it can be combined in a more precise way:

  • Monday-Friday from midnight until 4pm: 0 0-16 * * MON-FRI
  • Saturday-Sunday from 2am until 10am: 0 2-10 * * SAT-SUN

Having such environment variable:

  • AUTOMATED_CONVERSION_TIMEFRAME: ['0 0-16 * * MON-FRI', '0 2-10 * * SAT-SUN']

Then implement just ifcheck if the current time is within given CRON range.

Appreciate, Michal

@DrWarpMan
Copy link

Although such feature seems to be not implemented, as a workaround, you can take advantage of a pre-conversion hook (docs), that will pause the execution of the conversion as long as a certain condition is met.

An example pre-conversion hook could look like this:

#!/bin/sh

# ...

current_time="$(date +'%s')"
min_time="$(date -d '14:00' +'%s')"

while [ "$current_time" -lt "$min_time" ]; do
    echo "pre-conversion: Conversion is paused until 14:00"
    sleep 60
    current_time="$(date +'%s')"
done

(Make sure your timezone is set correctly within the container.)

Of course, you will have to implement your own pause condition logic depending on your needs.

@DrWarpMan DrWarpMan linked a pull request Apr 26, 2024 that will close this issue
@aronmgv
Copy link
Author

aronmgv commented Apr 27, 2024

:OOOOOOO

Am I having a Fairy Godmother or something??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants