Log into the server with user permissions to create schedules.
For this you can use SSH (console) or use resources of management tools of websites like Plesk, Cpnel, etc.
Via console (SSH), after logging in, run
crontab -e
This will open the logged-in user’s scheduling file.
For your case, you should create a schedule that runs every minute. Add something like this:
1 * * * * php /caminho/completo/do/script.php
To start editing, press the "I" key. It depends on the linux distribution and text editor.
Save the file change
(pressione) ESC
(digite) :wq
(pressione) ENTER
The letters wq mean "wRite" and "quit".
To make sure it’s even scheduled, run
crontab -l
A schedule list will be displayed.
However, this still does not guarantee much. If there is an error in the file path or the file script fails, you will not be able to know if there is no log, monitoring, etc.
To see if the path is correct, run on the console
php /caminho/completo/do/script.php
And see what happens. To test, put a echo time();
at the end or put a mail()
to send an email, file_put_contents()
to create a file, anyway. Invent whatever is convenient for testing.
Using a manager like Plesk, Cpanel, etc, you will have a page to create schedules in a friendlier way without using a console.
Usually just type the same command
1 * * * * php /caminho/completo/do/script.php
In Cpanel it is similar to this. The images are illustrative.
If you do not create cronjob (linux) or schedtask (windows), it will never run. See the documentation to understand how it works: https://laravel.com/docs/5.3/scheduling
– Daniel Omine
the only thing the documentation talks about is to run * * * * * php /path/to/Artisan Schedule:run >> /dev/null 2>&1, I did this but nothing :/
– Felipe Paetzold
I will specify
– Felipe Paetzold
@Danielomine is specified in the question
– Felipe Paetzold
@Danielomine It’s the first time I try to mess with Schedule, so I’m well lost kkkk
– Felipe Paetzold