Schedule page loading via CRON

1

I have a PHP page that checks the news feed for some blogs and writes the records to the database.

To do this, you just need to load the ex: "www.site.com/page.php" address, I would like to automate this in some way, to run once a day.

I tried to use CRON from my cpanel, but I do not know which command I can use. If you have another way to do this, you'll also be welcome.

    
asked by anonymous 17.12.2014 / 14:06

2 answers

3

Better to run crontab directly on the server. Crontab has the following format:

[minutos] [horas] [dias do mês] [mês] [dias da semana] [usuário] [comando]

The completion of each field is done as follows:

  • Minutes: Report numbers from 0 to 59;

  • Hours: Report numbers from 0 to 23;

  • Days of the month: Report numbers from 0 to 31;

  • Month: Report numbers from 1 to 12;

  • Days of the week: report numbers from 0 to 7;

  • User: is the user that 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 performed.

To run "my-script.php" every 1 hour, do the following:

# crontab -e
00 * * * * /usr/local/bin/php /home/pedrodelfino/meu-script.php

Other examples can be found in the following URL link just leave a hint, the path to the PHP file should be absolute , so everything will work fine.

    
17.12.2014 / 15:01
0

Go for the same cPanel. Selects the period and in the command places:

php /home/diretorio/ate/arquivo.php

    
17.12.2014 / 14:50