How To Use Cronjob In Octobercms?

- 1 answer

Lets suppose i want to delete record with id= 50 from my database with the help of cronjob in octobercms what are steps to do this

i did following things to achieve this
1)- In my plugin i put the following code

   public function registerSchedule($schedule)
    $schedule->call(function() {
         DB::table('fsz_posting_tblposting')->where('id', '==', 50)->delete();
    }); // Defaults to every minute (every execution)

2)- In my cronjob area of the server i put the following cronjob command

/usr/local/bin/php -q /home3/user/public_html/artisan scheduled:run

After doing these two steps my record is not deleted and i got the following email in my inbox

There are no commands defined in the "scheduled" namespace. Did you mean this?

what should i do now?



Seems some typo in your crontab entry

its schedule:run not scheduled:run[schedule]

Corrected entry :

/usr/local/bin/php -q /home3/user/public_html/artisan schedule:run

for more information you can referhere:

Setup :

How to add task :

if any doubts please comment.