System Administration Guide, Volume 2

Chapter 26 Managing System Resources (Overview)

This chapter contains overview information about miscellaneous features offered by the Solaris operating environment and other UNIX® software products to help you manage system resources by displaying general system information, monitoring disk space, setting disk quotas, using accounting programs, and scheduling crontab and at commands that automatically run routine commands.

This is a list of the overview information in this chapter.

Where to Find System Resource Tasks

Use these references to find step-by-step instructions for managing system resources.

What's New in Managing System Resources?

In this Solaris release, pseudo terminals are allocated dynamically. This means it is unnecessary to set the pt_cnt variable in the /etc/system file to increase the number of pseudo terminals in the system.

Displaying and Changing System Information

Chapter 27, Examining and Changing System Information (Tasks) describes how to find general system information such as the Solaris release the system is running, the amount of memory on a system, and the amount of available disk space.

Setting a system's date and time and increasing some system resources are also covered in this chapter.

What Are Quotas?

Quotas enable system administrators to control the size of UFS file systems by limiting the amount of disk space and the number of inodes (which roughly corresponds to the number of files) that individual users can acquire. For this reason, quotas are especially useful on the file systems where user home directories reside. (As a rule, public and /tmp file systems probably wouldn't benefit as much from the establishment of quotas.)

Setting up quotas involves these general steps:

  1. A series of commands prepares a file system to accept quotas, ensuring that quotas will be enforced each time the system is rebooted and the file system is mounted. Entries must be added to the /etc/vfstab file, and a quotas file must be created in the top-level directory of the file system.

  2. After a quota is created for one user, it can be copied as a prototype to set up other user quotas.

  3. Before quotas are actually turned on, another command checks for consistency by comparing the proposed quotas to the current disk usage making sure there are no conflicts.

  4. Finally, a command turns the quotas on for one or more entire file systems.

These steps ensure that quotas are automatically activated on a file system each time it is mounted. See Chapter 29, Managing Quotas (Tasks) for specific information about these procedures.

Once they are in place, quotas can be changed to adjust the amount of disk space or number of inodes that users can consume. Additionally, quotas can be added or removed as system needs change. See "Changing and Removing Quotas" for instructions on how to change quotas, disable individual quotas, or remove quotas from file systems.

In addition, quota status can be monitored. Quota commands enable administrators to display information about quotas on a file system, or search for users who have exceeded their quotas. For procedures that describe how to use these commands, see "Checking Quotas".

Executing Routine Tasks Automatically

Many routine system events can be set up to execute automatically. Some of these tasks should occur repetitively, at regular intervals. Other tasks need to run only once, perhaps during off hours such as evenings or weekends.

This section contains overview information about two commands, crontab and at, which enable you to schedule routine commands to execute automatically, avoiding peak hours or repeating commands according to a fixed schedule. crontab schedules repetitive commands, while at schedules commands that execute once.

Scheduling Repetitive Jobs: crontab

You can schedule routine system administration commands to execute daily, weekly, or monthly by using the crontab commands.

Daily crontab system administration tasks might include:

Weekly crontab system administration tasks might include:

Monthly crontab system administration tasks might include:

Additionally, users can schedule crontab commands to execute other routine system tasks, such as sending reminders and removing backup files.

For more information about scheduling crontab jobs, see Chapter 30, Scheduling System Events (Tasks).

Scheduling a Single Job: at

The at command allows you to schedule a job for execution at a later time. The job may consist of a single command or a script.

Like crontab, at allows you to schedule the automatic completion of routine commands. However, unlike crontab files, at files execute their commands once, and then are removed from their directory. Therefore, at is most useful for running simple commands or scripts that direct output into separate files for later examination.

Submitting an at job involves entering a command, following the at command syntax to specify options to schedule the time your job will be executed. For more information about submitting at jobs, see "at Command Description".

The at command stores the command or script you entered, along with a copy of your current environment variable in the /var/spool/cron/atjobs directory. As a file name, your at job file is given a long number specifying its location in the at queue, followed by the .a extension, such as 793962000.a.

The cron daemon periodically executes the atrun program, usually at 15-minute intervals. atrun then executes at jobs at their scheduled times. After your at job has been executed, its file is removed from the atjobs directory.

For more information on scheduling at jobs, see Chapter 27, Examining and Changing System Information (Tasks).

What is System Accounting?

The SunOS 5.8 system accounting software is a set of programs that enables you to collect and record data about user connect time, CPU time charged to processes, and disk usage. Once this data is collected, you can generate reports and charge fees for system usage.

The accounting programs can be used for:

After they're set up, the system accounting programs run mostly on their own.

Accounting Components

The accounting software provides C language programs and shell scripts that organize data into summary files and reports. These programs reside in the /usr/adm/acct and /usr/lib/acct directories.

Daily accounting can help you do four types of auditing:

How Accounting Works

Setting up automatic accounting involves putting the accounting startup script into crontab files so it can be started automatically by cron.

The following is an overview of how accounting works.

  1. Between system startup and shutdown, raw data about system use (such as user logins, running processes, and data storage) are collected in accounting files.

  2. Periodically (usually once a day), the /usr/lib/acct/runacct program processes the various accounting files and produces both cumulative summary files and daily accounting reports. The daily reports are printed by the /usr/lib/acct/prdaily program.

  3. Monthly, the administrator can process and print the cumulative summary files generated by runacct by executing the monacct program. The summary reports produced by monacct provide an efficient means for billing users on a monthly or other fiscal basis.

See Chapter 31, Managing System Accounting (Tasks) for instructions on setting up the accounting software. See Chapter 32, System Accounting (Reference) for reference information about the different accounting features.