Comments (11)
Mautic Docker uses crontab in the /etc/cron.d/ directory, so it does not appear in crontab -l.
It does not make much sense to run the commands as root because they can write the log and the www-data apache user can not read files created by root.
About the error:
Warning: fopen(/var/www/html/app/cache/prod/../run/sf.mautic-segments-update.5415eaf7823c0a036b252ba8a9f1f4065263e1c60a23cacf6b5851144245b8c9.lock): failed to open stream: Permission denied in /var/www/html/app/bundles/CoreBundle/Command/ModeratedCommand.php on line 150
Make sure the app / cache folder was created by root and set the property to www-data.
from docker-mautic.
I edited /etc/cron.d/mautic
and commented out the line starting with @reboot
and the jobs seem to be working for me now (except the @reboot
command of course). I haven't dug into exactly why @reboot
doesn't work, but here are some hints to investigate.
https://unix.stackexchange.com/questions/109804/crontabs-reboot-only-works-for-root
Also, I'm not sure if a reboot command makes sense for a docker container.
from docker-mautic.
@luizeof Do you have any ideas? Please help me.
from docker-mautic.
@RammusXu Please can you re-run the above commands, but this time when you get the permissions error, can you run ls -l
against the file in the fopen()
brackets and paste the input here?
from docker-mautic.
root@10e257dca355:/var/www/html/app/cache/run# ls -la /var/www/html/app/cache/prod/../run/sf.mautic-segments-update.5415eaf7823c0a036b252ba8a9f1f4065263e1c60a23cacf6b5851144245b8c9.lock
ls: cannot access '/var/www/html/app/cache/prod/../run/sf.mautic-segments-update.5415eaf7823c0a036b252ba8a9f1f4065263e1c60a23cacf6b5851144245b8c9.lock': No such file or directory
root@10e257dca355:/var/www/html/app/cache/run# ls -la
total 8
drwxr-xr-x 2 root root 4096 Sep 18 09:32 .
drwxr-xr-x 5 www-data www-data 4096 Sep 12 10:34 ..
root@10e257dca355:/var/www/html/app/cache/run# ls -la /var/www/html/app/bundles/CoreBundle/Command/ModeratedCommand.php
-rw-r--r-- 1 www-data www-data 6898 Jul 25 17:17 /var/www/html/app/bundles/CoreBundle/Command/ModeratedCommand.php
Is it clearly?
from docker-mautic.
hmmm, ok.
The offending code is https://github.com/mautic/mautic/blob/staging/app/bundles/CoreBundle/Command/ModeratedCommand.php#L150 so it's a case of tracking back where this is being called from and going from there
from docker-mautic.
Make sure the app / cache folder was created by root and set the property to www-data.
What does this mean, set the property to www-data?
Am also debugging this container now and /etc/cron.d/mautic
does not appear to be running, despite cron service status reporting ok - nothing coming through on the fifo /var/log/cron.pipe
.
Have checked cross referenced with Debian stretch cron documentation and it appears to be compliant. Will look in more detail tomorrow myself but ...
... has anyone progressed this at all? This image doesn't appear to have any syslogd
enabled.
from docker-mautic.
Thanks @jesseshieh , I will try and follow suit. I'm not totally convinced my workstation is not mangling CRLF
/LF
correctly, but the Debian stretch cron documentation does say that cron is very fussy with the final line in the file and the presence of a LF
vs an EOL
, so that might be worth checking as well.
from docker-mautic.
I've just tried taking the mautic.crontab
file, ensuring VSCode reports endings as LF
, saved it and copied it into my image in a derived dockerfile
overwriting the one from the published docker-mautic
image, and it is now working. This is with the @reboot
command enabled. I docker cp
'd the files out from the original mautic/mautic
image, and they're identical, line endings and all.
Digging a little deeper, the only difference I can see is the permissions applied to the file, essentially chmod 755
?
Debian stretch docs say that 644 is an appropriate setting though:
cron.other files:
the files under these directories have to be pass some sanity checks including the following: be executable, be owned by root, not be writable by group or other and, if symlinks, point to files owned by root.
cron.d files, as above and:
Files in this directory have to be owned by root, do not need to be executable (they are configuration files, just like /etc/crontab) and must conform to the same naming convention as used by run-parts(8)
Working:
File: /etc/cron.d/mautic
Size: 1793 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 1183275 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-10-16 13:37:33.651217100 +0000
Modify: 2018-10-16 13:35:09.000000000 +0000
Change: 2018-10-16 13:35:34.063797300 +0000
Wasn't working:
File: /etc/cron.d/mautic
Size: 1793 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 3160573 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-08-14 17:37:35.000000000 +0000
Modify: 2018-08-14 17:37:35.000000000 +0000
Change: 2018-09-13 14:38:41.453996500 +0000
Something seems inconsistent, perhaps it is an issue with the PHP base image.
from docker-mautic.
For me the cron was not working too but because of another reason. I have build my own Docker Image with Gitlab-CI and somehow the permissions at cloning of the repo changed to 666.
The cron-file is not allowed to have write-permission on group or other.
https://debian-administration.org/article/687/So_your_cronjob_did_not_run
So I have added this to my Dockerfile after the COPY of mautic.crontab and now it is working again:
# Ensure cron file has correct permissions
RUN chmod 644 /etc/cron.d/mautic
from docker-mautic.
This issue has been mentioned on Mautic Community Forums. There might be relevant details there:
https://forum.mautic.org/t/how-to-check-mautic-cron-jobs-inside-docker-container/19792/3
from docker-mautic.
Related Issues (20)
- Cannot set SMTP configuration in Mautic 5 HOT 2
- Queue for failures using RabbitMQ HOT 1
- env var to create admin user seems broken in V5 HOT 3
- mautic-web not allowed to connect to this MySQL server HOT 21
- How to upgrade from v4 to v5 HOT 2
- Mautic 5.0.3 FPM docroot issue HOT 2
- cronjob mautic:import won't work properly if added in cron/mautic
- Table 'messenger_messages' already exists - example/basic HOT 6
- Mautic seems to reinstall intself after taking pod down
- Update 5.0.4 HOT 8
- Docker composer is in bin but not working
- Building own image fails
- docker images for 4.4.12 are missing on hub.docker.com
- Mautic not installed problem HOT 1
- Email editor it is not possible to upload images grapesjsbuilder.assetManager.noAssets HOT 1
- On-the-fly asset generation is broken HOT 3
- Amazon SES on Mautic5 (docker-mautic image) HOT 1
- Title: Installation Issue with Mautic 5 using Docker: mQuery Function Error HOT 1
- [Suggestion] Mautic 5 - Plugins Install
- Mautic_cron can't access database due to no env variables in cron jobs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-mautic.