Reputation: 1353
i created a scheduled for my post adds, after expire date change the visible to zero "false".
My kernel
$schedule->call(function () {
foreach(Post::all() as $post)
{
if(Carbon::now() > $post->expire_date){
$s = new Post;
$data = array(
'visible' => 0,
);
$s->where('id', '=', $post->id)->update($data);
}
}
})->everyMinute();
When i do in Local a command:
php artisan schedule:run
it work well! But IN MY HOSTIND IT DOEN'T WORK! i tryed to add a job to my share hosting like this:
php /home/dixardin/public_html/regalo/regalo/laravel/artisan schedule:run >> /dev/null 2>&1
The structure folder is like the picture:
In my folder laravel i have the artisan file.
Upvotes: 1
Views: 1010
Reputation: 3422
There can be two errors
You can try to replace php
with php70
in php /home/dixardin/public_html/regalo/regalo/laravel/artisan schedule:run >> /dev/null 2>&1
. Maybe the webhost has php 7 (or another version) not renamed it to php.
You can look in the debug what kind of error there's generated. php /home/dixardin/public_html/regalo/regalo/laravel/artisan schedule:run
will be the new command.
Hope this works!
Upvotes: 1
Reputation: 3157
Try php-cli /home/dixardin/public_html/regalo/regalo/laravel/artisan schedule:run >> /dev/null 2>&1
Upvotes: 1