Contact Us Search Site Index About This Site Edit Decrease text size Increase text size Georgetown University main web site Contact Us Search Site Index About This Site
spacer spacer spacer
University Information Services at Georgetown University
Faculty Help Staff Help Student Help About UIS

HOME » SOFTWARE » MAC OS X (10.1)

HOW TO USE MAC OS X 10.1: USING THE CRON MAINTENANCE UTILITY

Cron is a Unix-based task scheduling utility. Cron runs scripts that automatically purge out-of-date log files, update system databases, and perform several other important maintenance tasks that keep your computer in good shape. Cron automatically runs three different scripts: one is run every day, one is run every week, and the third is run every month. Unfortunately, your computer has to be on (and not asleep) for Cron to run and the people at Apple have scheduled it to run between the hours of three and five o'clock in the morning.

So you have a couple of options: you can either leave your computer on all the time (which is something that UIS recommends against) or you can modify Cron so it will run while your computer is actually on.

Adjusting Cron is not hard, but it does require using the Terminal application and Unix commands. If you're unfamiliar with Unix, follow these instructions closely and do not improvise; making mistakes could cause serious damage to your operating system.  If you would like to learn more about Cron and the Terminal application in general, see Chris Stone's article, Learning the Terminal in Jaguar.

  1. Click on Go at the top of your screen, then Click on Applications.
  1. Double Click on the Utilities icon, then Double Click on the Terminal icon.
  1. This will bring up the Terminal.
  1. At the % prompt,
    Type cd /private/etc

    Note: There is a space between cd and the following slash (/)

  1. Then Press the Return key on your keyboard.
  1. This will switch you to the directory that holds the file we want to modify.
  1. The file we want to modify is called crontab.
    At the % prompt, Type sudo cp crontab crontab.bak then Press the Return key on your keyboard. This will create a back-up copy of crontab, just in case anything goes wrong.
  1. You'll be prompted for a password.
  1. Type your account password (the one you use to log in) then Press the Return key on your keyboard.

Note: You won't see anything when you type the password.

  1. At the % prompt, Type ls -alFg then Press the Return key on your keyboard.
  1. Scoll up and make sure your back-up file is there.
  1. Scroll back down to the prompt, Type
    sudo pico crontab then Press the Return key on your keyboard.
  1. This will bring up the Pico editor which you will use to edit the crontab file.

  • The daily script (shown here in yellow) is set to run at 3:15 every morning.

  • The weekly script (in magenta) is set to run at 4:30 in the morning on Saturdays (the sixth day).

  • The monthly script (in blue) is set to run at 5:30 in the morning on the first day of each month.

  1. Using the arrow keys on your keyboard to move the cursor, delete each time value and replace it with something more appropriate. In the line for the weekly script, change the value from Saturday (6) to a weekday (1 through 5).
  • Bear in mind that the hours follow a 24-hour system.
  • Make sure you choose times when you computer will be turned on and not in sleep mode.
  • Don't set the scripts to run during times when you might be very busy. The scripts shouldn't slow down your computer very much, but if you're struggling to meet a deadline, it might make a difference.
  • Set each script for a different time; you don't want more than one running at the same time.

    Using the values above, your daily script will run at 8:50 each morning; your weekly script will run at 4:40 on Friday afternoon (you may want to choose a different time if you often have Friday afternoon deadlines); and your monthly script will run at 9:30 in the morning on the first day of each month.

  1. When you have set the times and days, Press the control and O keys on your keyboard.
  1. This will bring up a prompt asking if you want to write the crontab file; Press the return key on your keyboard.
  1. You have now modified your crontab file; you can close the Pico editor by Pressing the control and X keys on your keyboard, then close the Terminal window. Cron will now run at the times you specified; you do not need to restart your computer.
spacer