Softpanorama

Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
May the source be with you, but remember the KISS principle ;-)
Bigger doesn't imply better. Bigger often is a sign of obesity, of lost control, of overcomplexity, of cancerous cells

Runlevels in HP-UX

News

Enterprise Unix System Administration

Recommended Links IT Resource Center forums - system administration HPUX Reference HP-UX Precompiled open source software Certification
Mounting the CD-ROM Mounting ISO image Runlevels in HP-UX Configuring NTP wu-ftpd TCP Wrappers HP-UX Logical Volume manager
Bash on HP-UX sudo for HPUX RPM on HP-UX Tips History Humor Etc

Startup and shutdown scripts for HP-UX 11.x are based on Unix System V-style initialization. In it seven runlevels exist, numbered from zero to six; though up to ten, from zero to nine, may be used. In addtion S is sometimes used as a synonym for one of the levels. The runlevel system replaced the traditional /etc/rc script used in Version 7 Unix.  "Runlevel" defines the state of the machine after boot. Different runlevels are typically assigned to: single-user mode multi-user mode without network services started multi-user mode with network services started system shutdown system reboot. 

Only a single(target) "runlevel" defined in inittab is executed on bootup --run levels are not executed sequentially. I.e. for runlevel 4 only runlevel 4 scrpts are executed, not 1, 2 then 3 and 4.

In HP-UX  when a computer enters runlevel zero, it reboots. The intermediate runlevels (1-5) differ in terms of which drives are mounted, and which network services are started. Default runlevels are typically 3 or 4. Lower run levels are useful for maintenance or emergency repairs, since they usually don't offer any network services at all. 

The startup and shutdown scripts in HP-UX recognize the following four arguments:

start_msg -- This is an argument passed to scripts so the that script can report a message indicating what the "start" action will do.

stop_msg --This is an argument passed to scripts so that the script can report a message indicating what the "stop" action will do.

start -- The script will start the application.

stop -- The script will shut down the application.

You may encounter problems during boot with one of the startup programs being hung. If this is the case Ctrl | (control and pipe) keys will normally break out of the script and continue to the next script. All startup and shutdown scripts, including the one in the previous listing, obtain configuration data from variables in /etc/rc.config.d.

Each runlevel has /sbin/rcX.d directory. For example for runlevel 3 this is /sbin/rc3.d. In it links to all scripts that are executed on this runlevel are put. You can list them using regula ls command, for example

ls -l /sbin/rc3.d

Links with the first level K is a "kill" link -- it executes script with stop parameter. A Link with the first letter S is a "start" link. It executes script with start parameter. Scripts starting with any other initial letter are ignored. 

Scripts are executed in lexicographical order. Gaps are left between startup scripts at a given run level and between shutdown scripts at a given run level, so when additional scripts are added, you don't have to renumber any existing scripts within a run level. Because applications are shut down in the opposite order in which they are started, shutdown scripts do not usually have the same numbers as their startup counterparts. Two applications that start in a given order due to dependencies will usually be shut down in the opposite order in which they were started. In our example, the startup number is S790coldfusion and the shutdown number is K300coldfusion.

Scripts are run when there is a change in run level. /sbin/rc is a program that is run whenever there is a change in run level. The following listing shows /etc/inittab, which invokes sbin/rc for each level:

 

Runlevels in HP-UX and Solaris

Flagword.net

In the following post I’d like to dwell upon differences between the run levels in Solaris and HP-UX.
So first, lets take a quick look at the description (man init(1M)) of the run levels which are supported in these two operating systems:

HP-UX

Run-level Description
0 Shut down HP-UX.
S|s Use for system administration (also known as "single-user state"). When booting into run level S at powerup, the only access to the system is through a shell spawned at the system console as the root user. The only processes running on the system will be kernel daemons started directly by the HP-UX kernel, daemon processes started from entries of type sysinit in /etc/inittab, the shell on the system console, and any processes started by the system administrator. Administration operations that require the system to be in a quiescent state (such as the fsck(1M) operation to repair a file system) should be run in this state. Transitioning into run level S from a higher run level does not terminate other system activity and does not result in a "single-user state"; this operation should not be done.
1 Single-User mode with local filesystems mounted (read-write). Start a subset of essential system processes. This state can also be used to perform system administration tasks.
2 Start most system daemons and login processes. This state is often called the "multi-user state". Login processes either at local terminals or over the network are possible.
3 Export filesystems and start other system processes. In this state NFS filesystems are often exported, as may be required for an NFS server.
4 Activate graphical presentation managers and start other system processes.
5-6 These states are available for user-defined operations.
 

Solaris
 

Run-level Description
0 Go into firmware
1 Put the system in system administrator mode. All local file systems are mounted. Only a small set of essential kernel processes are left running. This mode is for administrative tasks such as installing optional utility packages. All files are accessible and no users are logged in on the system.
2 Put the system in multi-user mode. All multi-user environment terminal processes and daemons are spawned. This state is commonly referred to as the multi-user state.
3 Extend multi-user mode by making local resources available over the network.
4 Is available to be defined as an alternative multi-user environment configuration. It is not necessary for system operation and is usually not used.
5 Shut the machine down so that it is safe to remove the power. Have the machine remove power, if possible.
6 Stop the operating system and reboot to the state defined by the initdefault entry in /etc/inittab.
S, s Enter single-user mode. This is the only run level that doesn't require the existence of a properly formatted /etc/inittab file. If this file does not exist, then by default, the only legal run level that init can enter is the single-user mode. When in single-user mode, the filesystems required for basic system operation will be mounted.
Q, q Re-examine /etc/inittab.

Apart from obvious distinctions between run levels with the same numbers, just take a closer look at run levels 5 and 6, there is a fundamental difference in a way that services are started/stopped when transition from on run-level to another takes place.


Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

HP Communities - how to view the current runlevel in hp-ux - Enterprise Business Community

05-23-2009

senthil_kumar_2

Hi

In Redhat and suse linux. we can use following command to view the current run level.

Ex:

suse10tst: # runlevel N 5

We can see the default runlevel in /etc/inittab.

but i want to know current runlevel of hpux.

is it possible.

Sajjad Sahir Honored Contributor

Dear Senthil

The command is who -r

thanks and regards

Sajjad Sahir ...



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least


Copyright © 1996-2018 by Dr. Nikolai Bezroukov. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) in the author free time and without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

 

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to make a contribution, supporting development of this site and speed up access. In case softpanorama.org is down you can use the at softpanorama.info

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: September, 12, 2017