Just create a script that performs the required task, test it by clicking the URL in your browser as soon as you make sure that it works correctly. Copy url and add cronjob
Then plan this command to run anytime you want to run
php ABSOLUTE_URL_TO_SCRIPT >> logfile
The log file is optional. But it will give you a chance to see what happened.
For example, if you want to run a script every 4 hours, and if your script is located at http: //localhost/work/scripty.php and it is assumed that your root is http - / var / www,
you would run "crontab -e" in the terminal and add the following line:
* */4 * * * php /var/www/work/scripty.php
If you need more information for comment only, I will update the answer.
source share