Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX System Administrator's Guide: Configuration Management: HP-UX 11i Version 3 > Chapter 2 Configuring System Parameters

Controlling Usage and Processes with Run-Levels

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

A run-level is an HP-UX state of operation in which a specific set of processes is permitted to run. These processes and default run-levels are defined in the file /etc/inittab.

The run-levels are:

Run-level s

The operating mode system administrators use (often called single-user mode). This mode ensures that no one else is on the system while you are performing system maintenance tasks. In this run-level, the only access to the system is through the system console by the user root. The only processes running on the system can be the shell on the system console, background daemon processes started by /sbin/rc, and processes that you invoke. Commands requiring an inactive system (such as /sbin/fsck) should be run in run-level s.

Run-level 1

Starts a subset of essential system processes; can also be used to perform system administrative tasks.

Run-level 2

The operating mode typically called multiuser mode. This mode allows all users to access the system.

Run-level 3

For NFS servers. In this mode, NFS file systems can be shared, as required for NFS servers.

For CDE users. In this mode, CDE is active. CDE is the default desktop on HP-UX 10.30 and later.

Run-level 4

Sometimes used by optional software.

Depending on the software installed on your system, the default run-level is usually run-level 3 or 4. The default run-level for CDE is 3.

To determine the current run-level of the init process, type:

# who -r . run-level 3 Mar 5 12:01 3 0 S

You can add to and change the sequence of processes that HP-UX starts at each run-level. For more information, see the HP-UX System Administrator’s Guide: Overview. Also see the inittab(4) manpage.

A superuser logged in at the system console can also change the current run-level with the /sbin/init and /sbin/shutdown commands, as follows:

  1. Warn all users who are currently logged in. Whenever the run-level of the system is changed, any process that does not have a run-level entry matching the new run-level will be killed. There is a grace period of 20 seconds after an automatic warning signal is sent.

  2. To change to run-level s, use the shutdown command.

    To change to a run-level other than run-level s, use the init command.

    See shutdown(1M) and init(1M).

CAUTION: Only use the shutdown command to change to run-level s (that is, do not use /sbin/init s).

The shutdown command safely brings your system to run-level s without leaving system resources in an unusable state. The shutdown command also allows you to specify a grace period to allow users to terminate their work before the system goes down. For example, to enter run-level s after allowing 30 seconds, enter:

# shutdown 30

To shut down immediately, enter one of the following:

# shutdown now
# shutdown 0

To achieve a true single-user mode with a quiet system, the best tactic is to reboot the system with an interrupted boot. See hpux(1M) and hpux.efi(1M) and the HP-UX System Administrator’s Guide: Routine Tasks.

Do not use run-level 0; this is a special run-level reserved for system installation.

For increased security, ensure that the permissions (and ownership) of the files /sbin/init and /etc/inittab are as follows:

# ll /sbin/init /etc/inittab -r--r--r-- 1 root sys 2152 Oct 17 01:25 /etc/inittab -r-xr-xr-x 1 bin bin 1968452 Oct 10 21:31 /sbin/init

Also, the size of inittab should be just a few KB while the size of init should be one to two MB, as shown.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2008 Hewlett-Packard Development Company, L.P.