shinsenter / php

📦 Simplified PHP Docker images for effortless customization and extension setup. Our Docker images cover PHP versions from 5.6 to 8.4, available in CLI, ZTS, FPM, FPM/Apache2, FPM/Nginx, RoadRunner, FrankenPHP, and Nginx Unit variants, for both Debian and Alpine versions. Updated everyday.
https://hub.docker.com/r/shinsenter/php
GNU General Public License v3.0
120 stars 27 forks source link

Cron task seems not work #132

Closed quentingosset closed 1 week ago

quentingosset commented 2 weeks ago

Hello, I followed your documentation (https://hub.docker.com/r/shinsenter/php#other-system-settings) on crontask, but it doesn't seem to work properly.

I have enabled the crontab on my docker-compose :

environment:
      ENABLE_CRONTAB: 1

I have not yet added any crontask in etc/crontab.d and I get the error :

crond: can't lock /var/run/crond.pid, otherpid may be 280: Resource temporarily unavailable
run-parts: /etc/hooks/bootstrap/50-crontabs exited with return code 1

When i try to add my crontask " * /usr/local/bin/php -q /var/www/html/artisan schedule:run 2>&1" on the folder etc/crontab.d this cron is never executed.

Do you have a idea ?

If you find my Docker images useful, consider donating via PayPal:
 -> https://www.paypal.me/shinsenter
(To edit this welcome message, add your text to /etc/welcome.txt)
---------------
Container     : shinsenter/php (built: 2024-08-22T15:17:38+0000)
Distro        : Debian GNU/Linux 12 (bookworm)
Timezone      : UTC (GMT+0000)
UID / GID     : www-data:www-data (33:33)
App Root      : /var/www/html
Document Root : /var/www/html
---------------
Docker Images by SHIN Company
Copyright (C) 2024 SHIN Company <shin@shin.company>
This software is free under the GNU General Public License (GPL).
You can redistribute and/or modify it under the terms of the GNU GPL.
This program is provided with the hope that it will be useful,
but it comes WITHOUT ANY WARRANTY. For more details, refer to the GNU GPL.
To get support, please contact: SHIN Company <shin@shin.company>
Docker Hub:      https://hub.docker.com/u/shinsenter
GitHub Packages: https://github.com/shinsenter?tab=packages
PHP 8.3.10 (fpm-fcgi) (built: Aug 13 2024 01:36:32)
Copyright (c) The PHP Group
Zend Engine v4.3.10, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.10, Copyright (c), by Zend Technologies
Composer version 2.7.8 2024-08-22 15:28:36
crond: can't lock /var/run/crond.pid, otherpid may be 280: Resource temporarily unavailable
run-parts: /etc/hooks/bootstrap/50-crontabs exited with return code 1
[25-Aug-2024 16:47:04] NOTICE: fpm is running, pid 1
[25-Aug-2024 16:47:04] NOTICE: ready to handle connections
shinsenter commented 2 weeks ago

@quentingosset

I can't reproduce the issue you're experiencing. Could you provide more specific details so that I can try to replicate your problem?

It seems like you're trying to run a Laravel project. If that's the case, you might want to try using Docker images for Laravel. https://hub.docker.com/r/shinsenter/laravel

Best regards

shinsenter commented 1 week ago

Hi @quentingosset

Could you help me try pulling the latest Docker images and give it another shot?

quentingosset commented 1 week ago

With your latest version I no longer get the error :

crond: can't lock /var/run/crond.pid, otherpid may be 280: Resource temporarily unavailable
run-parts: /etc/hooks/bootstrap/50-crontabs exited with return code 1

Thanks for your fix :)