lavary / crunz

A PHP-based job scheduler
MIT License
1.42k stars 136 forks source link

Hi, can you give an introductory video tutorial? I now have no effect on implementation. #392

Closed Tokyo-Lei closed 2 years ago

Tokyo-Lei commented 2 years ago

First of all, PHP7.4, centos 7 and Composer are running normally. Nothing happens during my execution.

file:

include('vendor/autoload.php');
use Crunz\Schedule;
$schedule = new Schedule();

$task = $schedule->run('php -v');
$task->on( '15:10 2021-12-17' );

return $schedule;

crontab -e

* * * * * cd /www/wwwroot/web && vendor/bin/crunz schedule:run

systemctl reload crond systemctl restart crond tail -f /var/log/cron

Dec 17 15:58:01 localhost crond[12153]: (root) RELOAD (/var/spool/cron/root)
Dec 17 15:58:01 localhost crond[12153]: (/www/wwwroot/web/vendor/bin/crunz) ERROR (getpwnam() failed)
Dec 17 15:58:01 localhost CROND[12596]: (root) CMD (cd /www/wwwroot/web && vendor/bin/crunz schedule:run)
PabloKowalczyk commented 2 years ago

Hello, it is highly advised to add path to PHP binary before Crunz (in crontab), for example /path/to/bin/php vendor/bin/crunz schedule:run. Also please see this threat https://stackoverflow.com/questions/41861683/getpwnam-failed-in-bin-sh-only-when-called-from-cron