Hello!

The problem is that I could not find a normal, understandable documentation for creating cron tasks. Everywhere I see something like this 01 * * * * root run-parts /etc/cron.hourly but I can’t understand where to insert it. I break my head 2 days, I decided to contact you. If you have normal documentation at hand or if you can briefly explain how to create a task, I will be very grateful.

Thank you in advance!

  • 3
    Cron is a Linux utility that runs some .php file in time. Crowning through PHP is a perversion in my opinion. As actually and the decision of any tasks except HTML generation. Read here about managing Cron using php ruseller.com/lessons.php?rub=37&id=1153 - koks_rs
  • 2
  • man cron is the normal, understandable documentation for creating cron-tasks. - Nick Volynkin

1 answer 1

You need to run a php script on a schedule, right?

To do this, run crontab in edit mode: #crontab -e In the file that opens, write something like:

 0 5 * * * php /path/to/script.php 

Save and exit. (If it is centos or similar, then esc, :wq , enter ). What is this line:

 Минута (0) Час(5) День_месяца(Каждый) Месяц(Каждый) День_недели(Каждый) команда(php /path/to/script.php). 

That is, script.php will run every day at 5:00 in the morning.

@koks_rs gave a great tutorial

  • Run crontab in edit mode, I can not understand this line, where to run it and how to run it? - Hakob Shaghikyan
  • In the linux console. In text mode. - Alexandr Blinov
  • And how can you do it without a console, only using php? - Hakob Shaghikyan
  • @HakobShaghikyan, in the first comment to your question, the link is given on the tutorial. - Visman
  • one