Web Hosting Articles

  Home arrow Web Hosting Articles arrow Page 2 - What is CRON and What Can it Do?
Web Hosting Articles  
Web Hosting FAQs  
Web Hosting How-Tos  
Web Hosting News  
Web Hosting Reviews  
Web Hosting Security  
Weekly Newsletter 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Contact Us 
Site Map 
Privacy Policy 
  >>> SIGN UP!  
  Lost Password? 

What is CRON and What Can it Do?
By: Rich Smith
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 17

    Table of Contents:
  • What is CRON and What Can it Do?
  • Cron for website and system maintenance
  • Cron for customer contacts
  • Cron without training wheels

  • Rate this Article: Poor Best 
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article




    What is CRON and What Can it Do? - Cron for website and system maintenance

    (Page 2 of 4 )

    One of the best and most popular uses of cron is for system maintenance.  This is true both for website maintenance and server maintenance in general.

    For those of you with websites, there could be a number of system activities you would want to run at night, including:

    • Cleaning up your database
    • Calculating daily totals
    • Sending yourself mail with daily statistics (# of hits, subscriptions, etc)
    • Expiring memberships
    • Updating calendars

    For example:

    Let's say you have a discussion forum, and you give out awards based on forum participation.  During the month, your users like to see where they stand, since it inspires healthy competition.  The calculations for reading through the entire database to figure out rankings are both CPU intensive AND time consuming.  In order to keep the load down on your box, and the page load time to a minimum, you design a cron that runs at 1:00 AM every morning, calculates all the data for the previous day, and writes it to a text file.  Then when people want to view the stats, you merely load the data from the text file to display it. This way, the intensive work runs only once a day, reducing the overall load on your server.  At the same time, the end users get a very fast page load, since it doesn’t have to go through the whole database every time.  This is a great example of using cron jobs effectively for your website.

    In addition to standard website maintenance, those who have a dedicated server may want to use the cron to schedule system maintenance as well.  This is how the good system administrators set up jobs to keep their systems in peak performance.  Jobs a system admin may include are:

    • Cleaning up disk space
    • Automatic optimization of db tables
    • Rotating Log Files
    • Cleaning up cache
    • Backing up databases and/or files
    • Checking for invalid links
    • Scan for viruses or rootkits

    As far as system maintenance is concerned, this is a very small list.  Depending on your system, you may have dozens of cron jobs scheduled for times throughout the day.

    For example:

    When running dynamic websites (websites where the content comes from a database), one of the most important things is the health of your database.  So it would make sense to have a cron job that runs around 2-3 AM that checks the integrity of your database, and repairs any issues it finds along the way.  I can tell you from experience that this sort of scheduled maintenance script is a true life saver.

    More Web Hosting Articles Articles
    More By Rich Smith


    - Top Wordpress Plugins for SEO
    - Top Drupal Evaluation and Rating Modules
    - Free Network Monitoring Programs for Max Per...
    - E-store Hosting: Free Options for Beginners
    - Dropbox: The Ultimate File-Sharing and Synci...
    - Reviewing the Best Free Web Hosting Sites
    - Businesses Turn to Reseller Web Hosting for ...
    - Multiple Data Center Hosting
    - Web Hosting Goes Green
    - Web Hosting Technology Overview
    - Collaborate: An Examination of Tools for Gro...
    - Social Networking Security
    - Domain Names 101
    - Top Software to Help Manage Your Websites
    - The Evolution of Phishing

    Developer Shed Affiliates


    © 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap