System Administration Guide, Volume 2

Inside a crontab File

The cron daemon schedules system events according to commands found within each crontab file. A crontab file consists of commands, one per line, that will be executed at regular intervals. The beginning of each line contains date and time information that tells the cron daemon when to execute the command.

For example, a crontab file named root is supplied during SunOS software installation. Its contents include these command lines:


10 3 * * 0,4 /etc/cron.d/logchecker
10 3 * * 0   /usr/lib/newsyslog
15 3 * * 0 /usr/lib/fs/nfs/nfsfind
1 2 * * * [ -x /usr/sbin/rtc ] && /usr/sbin/rtc -c > /dev/null 2>&1
30 3 * * * [ -x /usr/lib/gss/gsscred_clean ] && /usr/lib/gss/gsscred_clean

The first command line instructs the system to run logchecker at 3:10 on Sundays and Thursdays nights. The second command line schedules the system to run newsyslog at 3:10 every Sunday morning. The third command line orders the system to execute nfsfind Sundays at 3:15 in the morning. The fourth command line instructs the system to check daily for daylight savings time and make corrections if necessary. If there is no RTC time zone nor an /etc/rtc_config file, this entry will do nothing. The fifth command line instructs the system to check for and remove duplicate entries in the Generic Security Service table, /etc/gss/gsscred_db.

For more information about the syntax of lines within a crontab file, see "Syntax of crontab File Entries".

The crontab files are stored in /var/spool/cron/crontabs. Several crontab files besides root are provided during SunOS software installation (see the following table).

Table 30-2 Default crontab Files

crontab File

Function 

adm

Accounting 

lp

Printing 

root

General system functions and file system cleanup 

sys

Performance collection 

uucp

General uucp cleanup

Besides the default crontab file, users can create crontab files to schedule their own system events.

Other crontab files are named after the user accounts in which they are created, such as bob, mary, smith, or jones.

To access crontab files belonging to root or other users, superuser privileges are required.

Procedures explaining how to create, edit, display, and remove crontab files are described in "Commands for Scheduling System Events".