Server Administration

  Home arrow Server Administration arrow Introduction to crontab
SERVER ADMINISTRATION

Introduction to crontab
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 2
    2003-06-03

    Table of Contents:
  • Introduction to crontab
  • Sending the output
  • Thats all

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Introduction to crontab


    (Page 1 of 3 )

    In this tutorial, Jeff shows you the basics of crontab. Learn what they are, how to set one up, and even how to have it email you!

    By : Jeff Johnson

    The tutorial is about using crontab.Q: What is crontab?A: crontab is a program that runs commands at specified timesQ: So what do i need?A: You need a connection to a *nix box that has crontab installed

    More things to read: FreeBSD Man page, 2

    Starting off

    In this tutorial we will be using `ee` to edit are files. If you want the change the editor crontab uses type:

    `EDITOR=[some editor]`

    Now lets make our first crontab entry:

    $ crontab -e
    30 4 13 12 * /root/databasebackup

    Enter in that then save and exit (ee users: exc then enter). You should see:

    crontab: installing new crontab

    Now you may wounder what you just did?Line 1: Your ran the crontab program and told it you wanted to edit your crontab file.Line 2: You entered a string to tell crontab when to run the program.

    Here's what the numbers and stars ment:

     |- Run the 30'th minite
     |   |- Run on the 4th hour
     |   |   |- Run on the 13th day
     |   |   |    |-Run on the 12th month
     |   |   |    |   |-Run on any day of the month
     |   |   |    |   |  |-Run this command
    30   4   13   12  *  /root/databasebackup

    This will run on: 4:30am December 13th once a year on any day of the week.

    Now you probably will not want to run something once a year, most likely once a day/week/month. If you want to run something the 4th hour of every day and the 30th minute you would put:

    30 4 * * * <command>

    If you want to run a command on the 30th minnte of every hour, but only on Sunday you would put:

    30 * * * 0 <command>

    Another thing is to make it run at a certain interval by putting a *[number]/ in place of the number. To run a command every 10 minutes you would put:

    *10/ * * * * <command>

    More Server Administration Articles
    More By Codewalkers

    blog comments powered by Disqus

    SERVER ADMINISTRATION ARTICLES

    - Server Responses to Client Communication
    - Authentication in Client/Server Communication
    - Client/Server Communication
    - Understanding Awk in the UNIX Shell
    - Stream Editor in the UNIX Shell
    - Processes in the UNIX Shell
    - Migrating from Windows to Wine
    - Wine: Not Another Emulator
    - Preventive Measures to Block SSH Attacks
    - Monitoring Temperatures with Cacti
    - Cacti: RRDTool-based Graphing Solution
    - Network Magic 5.0 Review
    - Netfilter and Iptables Overview
    - Installing and Configuring Squid
    - Clickfree PC Backup Systems Compared


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