Cron Job not firing
BDS369 opened this issue · 6 comments
Hello -
I'm testing using your default docker config
docker run -d
--restart=always
--name vaultwarden_backup
--volumes-from=vaultwarden
--mount type=volume,source=vaultwarden-rclone-data,target=/config/
-e DATA_DIR="/data"
ttionya/vaultwarden-backup:latest
Not running on an arm processor.
Running a Synology DS1019+
I've added the environmental variable for my time zone (America/Chicago) and tried changing the cron values - but when I watch the logs it never even attempts to fire.
It starts up just fine - just never actually fires the backup job.
When I run the manual back up job -
docker run
--rm
--name vaultwarden_backup
--volumes-from=vaultwarden
--mount type=volume,source=vaultwarden-rclone-data,target=/config/
-e DATA_DIR="/data"
ttionya/vaultwarden-backup:latest backup
I get an immediate result - things look good.
Obviously I'd prefer to keep the container running and have the backup kick off on its normal schedule.
Any idea what I can look for? Kind of a newbie at this.
PS - I'm stuck with the manual job - I can schedule this using synologys task scheduler (have tested, as long as I run as root it works) however - where would I pass in environmental variables? I wouldnt want to be stuck with the defaults.
You are the first person to report that cron is not working on the x86 machine, and I am not sure what exactly happened. Could you please help to confirm if the correct time can be obtained in the container?
docker exec -it vaultwarden_backup bash
# Please run the `date` command multiple times inside the container to obtain the current time.
date
date
date
If it is indeed impossible to obtain the correct time, please refer to this guide, which mentions x86 containers and may be able to help you.
Looking forward to your test results.
the date reports correct each and every time.
Here's image of the putty session and the advanced settings.
I intentially have the cron job set to fire every 5 minutes for test purposes - but it has not fired no matter what I put in there.
The only time it fires is when I run manually.
Here's the log - no errors shown but it never updates at the cron job time either
I can't explain why - but now it appears to be running - at 5 minutes after the hour every hour.
I guess that's ok - but did I somehow not put in the Cron values correctly?
It appears that the Docker container is not utilizing the CRON
environment variable. You need to ensure that the container is recreated after every modification to the environment variable, rather than simply restarting it.
Please re-enter the container and print the value of the CRON environment variable.
docker exec -it vaultwarden_backup bash
echo ${CRON}
Of course, I cannot be certain that this is the true reason, but it seems that cron is not completely unable to execute. Therefore, it is reasonable to speculate that there may have been an error in passing the CRON
environment variable.
How do you recreate the container after stopping it? Do you have to delete it and start over?
Also - the date keeps jumping ahead a day - cant seem to keep it consistant
How do you recreate the container after stopping it? Do you have to delete it and start over?
docker run -d --restart=always --name vaultwarden_backup --volumes-from=vaultwarden --mount type=volume,source=vaultwarden-rclone-data,target=/config/ -e DATA_DIR="/data" ttionya/vaultwarden-backup:latest
If you are using docker-compose, you should run docker-compose down
and then execute docker-compose up -d
again.
If you are running it this way, make sure to clean up any previous containers each time you start up.
If the issue cannot be resolved, please set the CRON
environment variable and enter the container to print the value of CRON
(echo ${CRON}
).
Also - the date keeps jumping ahead a day - cant seem to keep it consistant
Sorry, I didn't quite understand the meaning you were trying to convey.