Open fenugrec opened 4 years ago
As a side-note, doesn't that periodic task need to run in the container that has app/cache ? or is there an interaction I don't understand between the cronjob and partkeepr containers ?
Hi @fenugrec,
thanks for the succession. Yes it's better to run cron as www-data
I'll give it a try or be happy to accept a PR. The interaction between the partkeepr container and the cronjob container is via the mounted volumes and by the use of the same database ...
Hi, in the recent commits you added a crontab to periodically run the "partkeepr:cron:run" task. Great ! However I notice that the command is run as root by default; shouldn't it run as www-data ? (at least according to https://wiki.partkeepr.org/wiki/PartKeepr_on_Debian_%22Stretch%22 ) I verified this first with a crontab containing
*/1 * * * * whoami > /tmp/w
then checking that indeed it's running as root. At first I tried the following modification
*/1 * * * * www-data whoami > /tmp/w
but it looks like that syntax is maybe not correct or not supported ? [EDIT - I may have made an error when testing, I forgot to delete /tmp/w which was still owned by root so www-data wasn't able to overwrite it...]
So instead we could change docker-compose.yml to run this instead:
command: bash -c "crontab -u www-data /etc/cron.d/partkeepr && cron -f"
What do you think ?