Hi, developers. I have a problem while developing a website. The database of this site should be updated every 15 minutes regardless clients visit or not. how can the database be updated periodically without clients' visiting of pages? I am wondering cPanel has such ability. but not sure and can't find such ability. Please help. Thank you.
In cPanel, click "Cron Jobs". Then select simple mode. For the command, try something like: php -q /home/username/public_html/path/to/file.php Code (markup): Hope this helps, Jay
Open SSH: crontab -e Code (markup): Enter a new line in the end: */15 * * * * php /directoryoffiletorun/filename.php Code (markup): or 15,30,45,59 * * * * php /directoryoffiletorun/filename.php Code (markup): Peace,
Something like this could be useful for counting users online or something similar. There are things that you can use a database cron for... lol
I was just kidding buddy. Reasons I can think of for running a script to update your database regularly; Removing expired content (Keeping diskspace low and load times down when users view site) Running scripts which are excessive on the servers resources at non-essential times (3AM) Pulling in news stories at specific times from RSS feeds e.g. the closing stock markets, yesterdays news, sports results Downloading the latest spam filters/ scripts for various applications e.g. PHPBB I'm sure there's hundreds more. I wouldn't say it's bad database design at all to keep your database updated instead of having it update as users join the site. If the database is updating non user activated information then processing the scripts for the database when a user is browsing means that you are causing unneccessary delays on the users browsing of your site.