Operating System - HP-UX
1748178 Members
4179 Online
108758 Solutions
New Discussion юеВ

Re: /etc/inittab and runlevels

 
MoreSawdust
Advisor

/etc/inittab and runlevels

A question about /etc/inittab behavior...

The last line in my /etc/inittab is as follows:

mFlm:2345:wait:sh /etc/mflmrcscript > /dev/null 2>&1

The max runlevel is 5, i.e. "init:5:initdefault:".

During system startup (and the eventual transition to runlevel 5), is the "mflmrscript" script executed once for each of the four runlevels in this entry? (a total of 4 times)

Thanks...
The people are the hardest part.
4 REPLIES 4
Hakki Aydin Ucar
Honored Contributor

Re: /etc/inittab and runlevels

inittab file contains entries in the following general format.

id:rstate:action:process

rstate (your question) : Multiple runlevels can be specified in this field. If no runlevel is given, the process is assumed to run in all runlevels. So in your example this script will run all of 2 ,3 ,4 ,5 run levels.

Hakki Aydin Ucar
Honored Contributor

Re: /etc/inittab and runlevels

>is the "mflmrscript" script executed once for each of the four runlevels in this entry?

No, only which run level you are going to initialize system and it is one of 2 3 4 5 , then it will be executed.
Aneesh Mohan
Honored Contributor

Re: /etc/inittab and runlevels


No , it will execute only once at runlevel 2 and it exist in other runlevels 3 , 4 and 5.

If you didnt put 3 , 4 5 then when runlevel 3 starts you service will get terminated.

For More Information ( man inittab)
==================

abstract from man page

Defines the run level in which this entry is to be
processed. Run levels correspond to a configuration of
processes in the system where each process spawned by
boot init is assigned one or more run levels in which
it is allowed to exist. Run levels are represented by
a number in the range 0 through 6. For example, if the
system is in run level 1, only those entries having a 1
in their rstate field are processed.

When boot init is requested to change run levels, all
processes that do not have an entry in the rstate field
for the target run level are sent the warning signal
(SIGTERM) and allowed a 20-second grace period before
being forcibly terminated by a kill signal (SIGKILL).
You can specify multiple run levels for a process by
entering more than one run level value in any
combination. If no run level is specified, the process
is assumed to be valid for all run levels, 0 through 6.


Aneesh
Hakki Aydin Ucar
Honored Contributor

Re: /etc/inittab and runlevels

>No , it will execute only once at runlevel 2 and it exist in other runlevels 3 , 4 and 5.

Correct, I just mean that, if you run the command for example ;

# init 3 ( OR init 2 )

it will be executed again.