2
Hello, I would like to know how to make a routine that every Monday, run a method in my system.
Thanks
2
Hello, I would like to know how to make a routine that every Monday, run a method in my system.
Thanks
3
You need to use the crontab(Linux) and cronjob(Windows).
You can type crontab -l to check scheduled tasks.
You can type crontab -and to add a new rule to a new task.
Format
[minutes] [hours] [days of the month] [month] [days of the week] [user] [command]
Minutes: enter numbers from 0 to 59;
Hours: enter numbers from 0 to 23;
Days of the month: enter numbers from 0 to 31;
Month: enter numbers from 1 to 12;
Days of the week: report numbers from 0 to 7;
User: is the user who will execute the command (it is not necessary to specify it if the user’s own file is used);
Command: the task that must be executed.
Example
45 19 1.15 ? * php script.php
Runs the.php script every Monday at 4:30 am.
In your case, just put the code inside your method, inside the php script..
Other option
It’s using javascript, every time the user updates the page, you take the day of the week, check if it’s Monday, if yes, then you make an ajax and run your php script.
-1
If your routine is in PHP or Linux shell, you can include a Cronjob on the server to run at the desired time.
-1
You can do this with a cron task. If you are using a cPanel hosting, the following link will guide you with ease: http://wiki.locaweb.com.br/pt-br/Tarefas_Cron_-_Painel_cPanel
Browser other questions tagged php codeigniter
You are not signed in. Login or sign up in order to post.
Dude.. your question is very good.. do you want to say without anyone having to run this application online? Just the server?
– Andrei Coelho
Exactly, @Andreicoelho
– Matheus Velloso
I found this here... http://googleweblight.com/? lite_url=http://rubsphp.blogspot.com/2010/10/tarefas-agendadas.html?m%3D1&ei=Pijtsrlc&lc=en-Br&s=1&m=958&ts=1444879723&Sig=Aponpfmeusfylq25h2xqs9p9jyix2phb9w
– Andrei Coelho
I think that solves
– Andrei Coelho
I even added it to my favorites one day I’ll need it
– Andrei Coelho
@Andreicoelho, thank you very much. But I don’t think that’s what I want
– Matheus Velloso
You need an agent with cron or similar, have a question here
– rray