doulai7239 2017-04-12 14:20
浏览 97
已采纳

Cron的工作不起作用,Laravel和cPanel

For some reason I no longer understand my cron does not work, when I execute the command schedule: run changes are made, however on the server nothing happens, I will explain each step to see if anyone can tell me that I can be doing wrong

this is the code of my command

<?php 
namespace App\Console\Commands;
namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Plan;
use App\Plan_negocio2;
use App\Plan_negocio;
use App\Pagina;
use DateTime;
use Illuminate\Console\Command;

//use Illuminate\Foundation\Inspiring;

class Resaltador extends Command {

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'res:resaltado';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Verificar Resaltador';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $plan=Plan_negocio::all();
        //$fechaAct=$request->fecha;

        if ($plan) 
        {
            $arrNegocio=[];
            foreach ($plan as $key => $value)
             {  
                //$value->fechafin=strtotime("2017-04-07")-time();

            date_default_timezone_set('America/Caracas');   
            $date = new DateTime($value->fechafin);
            $dateHoy=new DateTime();
            //$dat=$dateHoy->getTimestamp();
            $dat=9999999999999999;
            $value->fechafin=$date->getTimestamp();
            //$now = new DateTime();

                //$gene= $date1->format('U') - $now->format('U');


                if ($dat>$value->fechafin) 
                {
                 $negoPlan=Pagina::find($value->negocio_id);
                 $negoPlan->resalta_id=1;
                 $res=$negoPlan->save();

                }

             }
        }

    }

}

this, the code of the kernel

     <?php 
        namespace App\Console;

        use Illuminate\Console\Scheduling\Schedule;
        use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

        class Kernel extends ConsoleKernel {
            /**
             * The Artisan commands provided by your application.
             *
             * @var array
             */
            protected $commands = [

                //'App\Console\Commands\Inspire',
                \App\Console\Commands\Resaltador::class,
            ];

            /**
             * Define the application's command schedule.
             *
             * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
             * @return void
             */
            protected function schedule(Schedule $schedule)
        {
            /*$schedule->command('inspire')
                     ->hourly();*/

                     $schedule->command('res:resaltado')->everyMinute();
        }

}

When I execute the schedule: run command everything is fine

databse

success

enter image description here

enter image description here

But as I say, when I try to activate it from the server I do not understand that it can be wrong, I leave the steps

In the folder 'loupper' is where I have stored laravel, with putty I get the path and assign it to the cron jobs manager in cpanel

enter image description here

enter image description here

I don't have composer on the server, but investigating I read that it is not necessary,However nothing happens, what can I be doing wrong?

UPDATE: I just checked and this email has arrived

/usr/local/cpanel/bin/jailshell: php/home3/pixsony6/public_html/loupper.com/loupper/artisan: No such file or directory
  • 写回答

1条回答 默认 最新

  • douyan8413 2017-04-12 14:29
    关注

    You are missing a space between php and the path in cPanel

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog