Comments (8)
we should implement go-crond to get rid of the environment issue :)
from php-docker-boilerplate.
Hi @nverhoye,
Environments differs between shell and crontab, you can check it with printenv
in shell / crontab
I use approach 2
Try something like this:
* * * * * application . ~/.profile; /usr/local/bin/php /app/foo.php
from php-docker-boilerplate.
The environment parameters are not passed to cronjobs. They are filtered by default and AFAIK there is no way to fix this other then replacing the cron daemon.
I will replace cron with gocrond this weeks to get rid of this stupid issue
from php-docker-boilerplate.
Hey, I just created an example of how to use crontab with webdevops docker-compose, you can check it our here:
https://github.com/abagayev/docker-bootstrap-collection/tree/master/crontab-in-container
from php-docker-boilerplate.
Hi @kyrilg
Thanks for your reply, but it still does not work unfortunately.
I pushed
* * * * * application . ~/.profile; /usr/local/bin/php /app/foo.php
Instead of
# m h dom mon dow user command
* * * * * php /app/foo.php
No result :(
from php-docker-boilerplate.
please make sure you have an empty line at the end (cron requirement).. otherwise your crontab is ignored, also make sure the permissions are correct and not world writeable.
go-crond will fix this with correct error messages.
from php-docker-boilerplate.
Hi @mblaschke, i have an empty line at the end (cron requirement), also permissions are correct (0644).
Below crontab used now :
* * * * * application . /home/application/.profile; /bin/bash /app/scheduler_cron.sh --mode always >> /app/cron.log 2>&1
# An empty line is required at the end of this file for a valid cron file.
NOW file is executed, but file can't do works asked. I have message returned : "Could not find a binary for php"
This is content of scheduler_cron.sh :
#!/bin/bash
# Generate an error if any variable doesn't exist
set -o nounset
# Location of the php binary
PHP_BIN=$(which php || true)
if [ -z "${PHP_BIN}" ]; then
echo "Could not find a binary for php" 1>&2
exit 1
fi
In cron task "which php" return empty
BUT when i'm connected to docker's container it return '/usr/local/bin/php'
See :
docker exec -it app bash
root@03dc0dd62e77:/$ su application
application@03dc0dd62e77:/$ which php
/usr/local/bin/php
Any ideas ? Thanks
from php-docker-boilerplate.
Hi @mblaschke, can you share the solution ? Thanks
from php-docker-boilerplate.
Related Issues (20)
- Docker Hub
- webdevops / php-apache-dev: 7.1 php.ini
- Make Bash Command Change
- Fails on Windows 10 HOT 1
- Usage phpMyAdmin HOT 6
- How to use mailhog? HOT 1
- How to use PHP 7.1 or even PHP 7.2? HOT 3
- I can not connect to mysql with sequel pro HOT 4
- Can't connect to database from PHP HOT 1
- app folder not working HOT 2
- Set up many virtual hosts in main app container HOT 1
- Is there a more detailed document? HOT 1
- How to use crontab HOT 2
- image for php > 7.0 HOT 1
- directory index of "/app/public/" is forbidden
- Isolation from the external networks HOT 2
- php.ini date.timezone error HOT 4
- Posts aren't shown
- how to use apache - centos-7 - php7.4
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 php-docker-boilerplate.