I want to fetch certain data from website every 24 hours. The code must be executed every 24 hours and update the MySQL database. How can I accomplish this without any user events?
Later i'll use same data to find the total difference.
totalIncrement = currentData - earlierData
While earlierData is fetched from the MySQl database and current data is fetched from the external website query.
I've heard of a cron on linux but have never tried it. Can any body just give a basic idea for that? or any reliable link?
May be i want to do it like this::
First create a PHP program/file that does the fetching job. Second execute that PHP file every 24 hours or so...
Open a shell.
(Stop crond service service crond stop)
Use vi (or other editor) to edit cron file or type "crontab -e" to make your edit.
After edit hit "ESC". Then ":wq", to save and quit.
(Start the service again service crond start)
Stopping and starting the service is not needed if you use crontab -e.
Your script should be running by now. Check the syntax here or here. To view the changes you've made type "crontab -l".
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With