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 Security  
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
ASP Web Hosting  
ASP.NET Web Hosting 
Budget Hosting 
Coldfusion 
Colocation 
Mobile Linux 
APP Generation ROI 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Reseller Web Hosting 
Shared Hosting 
Small Business Hosting 
Virtual Private Servers 
Windows Web Hosting
 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WEB HOSTING ARTICLES

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 / 15
    2006-06-28

    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 
      ADD THIS ARTICLE TO:
      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
     
     
    ADVERTISEMENT


    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


       · When used correctly, CRON can be one of the most valuable tools in your toolbox.
     

    WEB HOSTING ARTICLES ARTICLES

    - 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
    - Is Clickfire the Only Honest Web Host Review...
    - Budget Web Hosting is More Affordable Than E...
    - Linux Hosting vs. Windows Hosting
    - Drupal: Content Management Made Easy
    - Completing the Ultimate in Home Page Customi...
    - The Ultimate in Home Page Customization






    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek