I have this in my Kernal.php
$schedule->call(function () {
DB::table('news')->delete();
})->everyMinute();
when i do
php artisan schedule:run
it works fine.
But when i use cpanel and write in cron job
php /home/allnewsnepal/public_html/artisan schedule:run >> /dev/null 2>&1
the code doesnt run automatically.I dont have access to shell of cpanel.
2
Answers
Thanx for the help . I got my problem solved by doing
For cron’s in cPanel, you can look in this post:
Run a PHP file in a cron job using CPanel
The things that you should pay attention to are:
In order to start a cron job on Linux based systems, you must specify the user for that cron, let’s say the user is root, so the cron job would look like this:
Of course with * prefixes depending on your cron schedule