fmartinou / whats-up-docker

What's up Docker ( aka WUD ) gets you notified when a new version of your Docker Container is available.
https://fmartinou.github.io/whats-up-docker
MIT License
1.09k stars 34 forks source link

Cron expression for watcher not works as expected #410

Closed KurumiSerori closed 3 months ago

KurumiSerori commented 3 months ago

the environment variable was configured as: ...

Here is the full log after startup,

2024/06/26 01:21:12,stdout,01:21:12.951 INFO whats-up-docker/watcher.docker.local: Status changed from exited to running (container=local_linuxserver-radarr) 2024/06/26 01:14:01,stdout,01:14:01.495 INFO whats-up-docker/watcher.docker.local: Status changed from exited to running (container=local_linuxserver-jackett) 2024/06/26 00:28:12,stdout,00:28:12.065 INFO whats-up-docker/watcher.docker.local: Status changed from running to exited (container=local_linuxserver-radarr) 2024/06/26 00:27:04,stdout,00:27:04.549 INFO whats-up-docker/watcher.docker.local: Status changed from running to exited (container=local_linuxserver-jackett) 2024/06/26 00:22:24,stdout,00:21:48.852 INFO whats-up-docker/watcher.docker.local: Cron finished (0 containers watched, 0 errors, 0 available updates) 2024/06/26 00:21:48,stdout,00:21:48.851 WARN whats-up-docker/watcher.docker.local: Error when processing some containers (Cannot read properties of undefined (reading 'tag')) 2024/06/26 00:20:03,stdout,00:20:00.665 INFO whats-up-docker/watcher.docker.local: Listening to docker events 2024/06/26 00:20:03,stdout,00:20:00.657 INFO whats-up-docker/watcher.docker.local: Cron started (0 0/6 ) 2024/06/26 00:20:03,stdout,00:19:59.796 INFO whats-up-docker/api: Server listening on port 3000 (HTTP) 2024/06/26 00:20:03,stdout,00:19:59.790 WARN whats-up-docker: Anonymous authentication is enabled; please make sure that the app is not exposed to unsecure networks 2024/06/26 00:20:03,stdout,00:19:59.784 INFO whats-up-docker/authentication.anonymous.anonymous: Register with configuration {} 2024/06/26 00:20:03,stdout,00:19:59.658 INFO whats-up-docker/registry: No authentication configured => Allow anonymous access 2024/06/26 00:20:03,stdout,00:19:59.651 INFO whats-up-docker/watcher.docker.local: Cron scheduled (0 0/6 ) 2024/06/26 00:19:59,stdout,00:19:59.650 INFO whats-up-docker/watcher.docker.local: Register with configuration {\"cron\":\"0 0/6 *\",\"socket\":\"/var/run/docker.sock\",\"port\":2375,\"watchbydefault\":true,\"watchall\":false,\"watchevents\":true} 2024/06/26 00:19:57,stdout,00:19:55.746 INFO whats-up-docker/registry.quay: Register with configuration {} 2024/06/26 00:19:57,stdout,00:19:55.743 INFO whats-up-docker/registry.hub: Register with configuration {} 2024/06/26 00:19:57,stdout,00:19:55.740 INFO whats-up-docker/registry.ghcr: Register with configuration {} 2024/06/26 00:19:57,stdout,00:19:55.738 INFO whats-up-docker/registry.gcr: Register with configuration {} 2024/06/26 00:19:57,stdout,00:19:55.736 INFO whats-up-docker/registry.ecr: Register with configuration {} 2024/06/26 00:19:57,stdout,00:19:50.194 INFO whats-up-docker/trigger.smtp.gmail: Register with configuration {\"user\":\"XXXXXX\",\"to\":\"XXXXXXX\",\"tls\":{\"enabled\":true,\"verify\":true},\"port\":465,\"from\":\"XXXXXXX\",\"host\":\"smtp.gmail.com\",\"pass\":\"XXXXXXXX\",\"threshold\":\"all\",\"mode\":\"simple\",\"once\":true,\"simpletitle\":\"New ${kind} found for container ${name}\",\"simplebody\":\"Container ${name} running with ${kind} ${local} can be updated to ${kind} ${remote}\n${link}\",\"batchtitle\":\"${count} updates available\"} 2024/06/26 00:19:57,stdout,00:19:49.949 INFO whats-up-docker/registry: Register all components of kind trigger for provider smtp 2024/06/26 00:19:51,stdout,00:19:49.775 INFO whats-up-docker/prometheus: Init Prometheus module 2024/06/26 00:19:51,stdout,00:19:49.617 INFO whats-up-docker/store: Load store from (/store/wud.json) 2024/06/26 00:19:49,stdout,00:19:49.616 INFO whats-up-docker: What's up Docker? is starting (version = latest)

also the number of "watched containers" reported by cron job is not as expected (and not same with what can be seen from the UI), I'm not sure if not detecting any containers in this cron job caused the unexpected behavior.

fmartinou commented 3 months ago

Hi, are you sure that your cron syntax is correct? (crontab.guru reports it as non standard)

Can you try with 0 */6 * * *?

KurumiSerori commented 3 months ago

fine, but it should be common syntax nowadays. Imagine if you want to run some recipe every 6 hours from 8 a.m., the only way to do that seems to be this way.

I’ll try the “*/6” style later and see if the problem will be solved.

KurumiSerori commented 3 months ago

migrating to "*/6" solved the problem, still it would be great if we can support the non-standard format.

fmartinou commented 3 months ago

You can log a feature request on the node-cron lib => https://www.npmjs.com/package/node-cron

(the underlying lib used)