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

Schedule issue #2036

Open
jmaffie opened this issue Oct 6, 2024 · 3 comments
Open

Schedule issue #2036

jmaffie opened this issue Oct 6, 2024 · 3 comments

Comments

@jmaffie
Copy link

jmaffie commented Oct 6, 2024

Describe the bug

WATCHTOWER_SCHEDULE 0 0 20 1-7 * FRI is interpreted as 20:00 every friday and every 1-7th of the month. I believe this expression should be interpreted as 20:00 the first friday of the month.

Steps to reproduce

set the env variable WATCHTOWER_SCHEDULE to "0 0 20 1-7 * FRI"

Expected behavior

run at 20:00 the first friday of the month

Screenshots

No response

Environment

up to date docker and container as of this date. running on Ubuntu LTS 20.04

Your logs

INFO[0001] Watchtower 1.7.1                             

INFO[0001] Using no notifications                       

INFO[0001] Checking all containers (except explicitly disabled with label) 

INFO[0001] Scheduling first run: 2024-10-11 20:00:00 -0400 EDT 

INFO[0001] Note that the first check will be performed in 142 hours, 47 minutes, 18 seconds

Additional context

No response

Copy link

github-actions bot commented Oct 6, 2024

Hi there! 👋🏼 As you're new to this repo, we'd like to suggest that you read our code of conduct as well as our contribution guidelines. Thanks a bunch for opening your first issue! 🙏

@reynaldichernando
Copy link

I can confirm that the above cron expression 0 0 20 1-7 * FRI runs every Friday, not only on the first Friday of the month. Looking at the crontab, the next schedules will happen on every other Fridays.
image

However, I think this is more about the cron expression rather than a bug in watchtower. This cron expression 0 0 20 */100,1-7 * FRI will achieve the first Friday of the month schedule (crontab).

image

Reference for why the second cron expression works: https://blog.healthchecks.io/2022/09/schedule-cron-job-the-funky-way/

@reynaldichernando
Copy link

Testing it out on watchtower

docker run \        
    --name watchtower \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    containrrr/watchtower \
    --schedule "0 0 20 */100,1-7 * FRI"

Output

time="2024-10-14T17:19:36Z" level=info msg="Watchtower 1.7.1"
time="2024-10-14T17:19:36Z" level=info msg="Using no notifications"
time="2024-10-14T17:19:36Z" level=info msg="Checking all containers (except explicitly disabled with label)"
time="2024-10-14T17:19:36Z" level=info msg="Scheduling first run: 2024-11-01 20:00:00 +0000 UTC"
time="2024-10-14T17:19:36Z" level=info msg="Note that the first check will be performed in 434 hours, 40 minutes, 23 seconds"

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

No branches or pull requests

2 participants