-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
[BUG] Cron not working #121
Comments
Hey @ryck |
Yes, I am using |
I actually have the same issue with a manual install (from my playbook of course :)) I believe it's not properly getting stuff out of /etc/profile and that's why it's failing. Seeing the cron issue on Ubuntu 18.04 + Armbian 20.04 Focal. |
I'm using |
Sorry about the delay, I'm looking into this now. I have confirmed that I can reproduce this issue locally. |
I could suggest little workaround. Crontab (I mean edit crontab -e and add job) failed for me too, but I found that adding a job by creating file in /etc/cron.daily works (Debian & Ubuntu). #!/bin/sh COLLECTOR="/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64" "$COLLECTOR" run --api-endpoint "http://$WEB:8080" --config "$CONF" |
So I added some logging to the I'm considering using real |
@AnalogJ You could have a simple script with a sleep loop that is supervised by s6, something like: #!/bin/bash
while true; do
/scrutiny/bin/scrutiny-collector-metrics run
sleep 86400
done similar to the current jobber config of 'run at midnight', although this wouldn't be at midnight it would just be daily from the time the container started. Otherwise if cron semantis are desired I suspect there are wealth of lightweight 'cron for docker' tools out there now. This one looks interesting https://github.com/webdevops/go-crond |
Hi everyone.
If you would like to change the collector frequency, you can mount your own crontab compatible file, but please include the Sorry for the long delay fixing this issue, I had a bunch of personal/professional stuff to take care of. |
Relieved to see this project alive. Bravo! I'll look at updating things
some time soon.
…On Sun, 25 Apr 2021, 04:46 Jason Kulatunga, ***@***.***> wrote:
Hi everyone.
I recently updated both the collector and all-in-one container to use
Cron, rather than jobber.
As before, the collector is scheduled to run daily, at midnight. The
images now read their cron config from /etc/cron.d/scrutiny, with a
default file that looks like the following:
# correctly route collector logs (STDOUT & STDERR) to Cron foreground (collectable by Docker STDOUT)
# cron schedule to run daily at midnight: '0 0 * * *'
# System environmental variables are stripped by cron, source our dump of the docker environmental variables before each command (/env.sh)
0 0 * * * root . /env.sh; /scrutiny/bin/scrutiny-collector-metrics run >/proc/1/fd/1 2>/proc/1/fd/2
If you would like to change the collector frequency, you can mount your
own crontab compatible file, but please include the . /env.sh; prefix
when running the collector (it's required to pass docker env vars to the
process).
Sorry for the long delay fixing this issue, I had a bunch of
personal/professional stuff to take care of.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#121 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKONLFB53TBX35DWUBCOSLTKMU3RANCNFSM4T7L4SIQ>
.
|
…g SCRUTINY_COLLECTOR_CRON_SCHEDULE env variable. similar to linuxserver/docker-scrutiny#19 fixes linuxserver/docker-scrutiny#17 fixes #161 fixes #66 fixes #202 fixes #121
The cron job still/again doesn't seem to work. I narrowed the problem down to the The cron interval is exported without quotes Calling the (cron job) commands It's easy to fix by changing the export to |
Hey @Panzer1119 any chance you have a couple of minutes to chat about this over Discord? I cant seem to replicate this issue when I set the COLLECTOR_CRON_SCHEDULE environmental variable in the docker compose file: environment:
- "COLLECTOR_CRON_SCHEDULE=*/1 * * * *" |
ahh I think I found the issue.
The first command generates the following scrutiny crontab, which I'm guessing is what you're seeing
|
I think the problem is that the crontab and Cron wants the schedule not quoted |
Yeah, thanks for the pointer @Panzer1119 I made a couple of changes, but the big two are: Basically the env variables are always quoted, and then I strip the quotes when templating the crontab file. I'm waiting for a docker build to complete, but I've tested this locally and its working. |
closing since I have verification that this has been fixed in v0.4.4. |
Hi @AnalogJ, I'm not able to get cron to work in the
Running the commands manually within the container gathers the SMART data and updates the web interface as expected, so it doesn't appear to be anything wrong with the configuration of either container. I'd appreciate any assistance you could offer. |
@MattKobayashi ugh. Sorry about that. I spent a ton of time figuring out the root cause and fixing it in the omnibus container, but it seems I forgot to make the fix in the collector image as well. |
…. This is for ease of maintainability. related #121
alright, confirmed working collector:
image: 'ghcr.io/analogj/scrutiny:master-collector'
cap_add:
- SYS_RAWIO
volumes:
- '/run/udev:/run/udev:ro'
environment:
COLLECTOR_API_ENDPOINT: 'http://web:8080'
COLLECTOR_CRON_SCHEDULE: '*/1 * * * *'
depends_on:
web:
condition: service_healthy
devices:
- "/dev/sda"
- "/dev/sdb" I updated the https://github.com/AnalogJ/scrutiny/blob/master/docker/example.hubspoke.docker-compose.yml example compose file, and the collector correctly runs every minute. Creating a release now @MattKobayashi |
You're a legend @AnalogJ, thank you! |
I'm guessing that fixed the issue @MattKobayashi :D |
It certainly did @AnalogJ, thank you again 😄 |
Does changing the chron schedule currently work? After reading through this issue, I put
into my docker-compose (I'm using the omnibus docker image), but inside of the container in
it always says
no matter what I actually put in the env. Looking at the web ui, it even seems as though a refresh never actually happens, running the collectur manually works as expected though. Edit: just now saw issue #602 - so I guess there's a bug |
Describe the bug
The cron job doesn't not work (anymore)
The collector / webapp combo still works if I trigger it manually, but for some reason the cron job doesn't work anymore (it was working before)
I haven't changed my setup (apart from update the images) and I can't see anything wrong on the logs....
Happy to provide you with logs or anything that you need...
Expected behavior
The webapp should update daily with new metrics
Current behavior
The webapp does not get updated unless you run
scrutiny-collector-metrics run
in each collectorThe text was updated successfully, but these errors were encountered: