-->
Page 275
directory. You can read this manual page as follows:
# man 5 crontab
Your crontab file should contain settings to start programs you want to run at regular and even not-so-regular times, for example:
* * * * * somecommand 0,15,30,45 * * * * somecommand 0 * * * * somecommand
The first example shows you'd like to run a program every minute. The second crontab entry runs a program every 15 minutes. The third example shows you'd like to run a program once an hour, on the hour.
If you'd like to run a program once a day at an appointed time, you can use:
30 7 * * * somecommand 30 0 * * * somecommand 15 16 * * * somecommand
The first example runs at 7:30 a.m. The second example runs at 30 minutes past midnight. The third example runs at 4:15 p.m. each day. You can also run a program on a specific day of the month or the week, for example:
30 16 1 * * somecommand 30 15 * * mon somecommand
The first example runs at 4:30 p.m. on the first day of each month, and the second runs at 3:30 p.m. each Monday. To round out these examples, you can also specify a particular month, or example:
30 7 25 12 * somecommand
This command runs the command at 7:30 a.m. on each December 25. The commands you specify can also be system utilities or even your own shell scripts. You can use the crontab command's -l (list) option to print your cron settings, for example:
# crontab -l # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.1911 installed on Mon Dec 8 18:52:52 1997) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) 0,30 * * * * /usr/local/bin/saytime 0 8 * * * * /usr/local/bin/ppp on 3 8 * * * * /usr/local/bin/popclient -u bball -p mypasswd staffnet.com
This shows a crontab file that speaks the time every half hour, starts a PPP connection at 8 a.m. every day, and downloads the day's mail three minutes after the PPP connection has started. You can remove your crontab file with the crontab command's -r (remove) option, for example:
# crontab -r
Using the crontab command is an easy way to create, run, and manage regular tasks. Even
Page 276
though you can create your own reminders, you'll want to use a calendar for short- or long-range planning.
You can use Sanjay Ghemawt's ical calendar to store appointments and reminders in a personal calendar. The ical client, found under the /usr/X11R6/bin directory, has a number of unique features and improvements over the cal or gcal calendar printing programs:
When you first run ical, the program shows the current month, set to the current day, along with a note, or appointment entry list on the right. The ical client also uses many of the standard X Toolkit command-line options, so you can change geometry settings to set the initial calendar size, or start the ical client as an icon, for example:
# ical -iconic
or
# ical -geometry 800x600
Figure 18.1 shows the ical client.
Notices are created by selecting a day, then clicking on and typing in the box below
the calendar. Appointments for the day are created by clicking on a specific time, and
typing in the name of the appointment. You can drag appointments anywhere during
the day to rearrange your schedule by holding down the middle mouse button (or both left and
right mouse buttons if you're using a two-button mouse).
Page 277
Figure 18.1.
The ical X11 client features notices, appointments, to-do lists, and reminder alarms.
After you have set your notice or appointments, you can also set an alarm to have the ical client warn you of an upcoming event. To set a reminder alarm, first click on the appointment, then select the Item menu's Properties item to set an alarm for an appointment. You can also just double-click on the appointment to bring up the alarm dialog.
You can tell ical to remind you from 1 to 15 days in advance, with up to 60 warnings the hour before an appointment. The ical alarm notice window will pop up at the preselected times as a reminder.
TIME SAVER |
The ical client must be running in order to receive alarms. You can, however, use the ical command and its -popup command-line option in a crontab entry. If you use -popup, ical will list all of the day's appointments in a window, then exit after you press the Okay button. |
Figure 18.2 shows the ical client's alarm dialog.
If you select an appointment or notice, you can also make it repeat daily, weekly, monthly, or annually by selecting the pertinent Repeat menu item. When you cause an item to
Page 278
Figure 18.2.
The ical client's alarm dialog features multiple, cascading alarms, with drag-and-drop controls.
repeat, it will automatically be duplicated in your calendar.
Appointments can also be made to-do items, by clicking on the appointment, then selecting Todo from ical's Item menu. A box will appear at the beginning of the text. Until you complete the item by clicking in the box with your left mouse button to place a check mark, the to-do item will reappear on the next day's list of appointments.
You can list your appointments and notices by using ical's List menu. If you'd like hard copy of your calendar, you can print six different built-in calendar formats, or specify a range of days. Before you print, you can also preview your calendar.
The ical client is a convenient way to organize personal or group tasks. You'll also want to take a look at some of ical's companion shell scripts and programs under the /usr/lib/ical/contrib directory, to find tips and hints on how to customize ical to suit your needs.
The emacs text editor, more fully discussed in Hour 14, "Text Processing," has a number of features that can help your personal productivity or even keep you amused. You can check the current calendar, see a list of holidays (and more), and keep a diary with