Operating System - HP-UX
1784540 Members
1619 Online
109157 Solutions
New Discussion юеВ

how to view the current runlevel in hp-ux

 
SOLVED
Go to solution
senthil_kumar_2
Regular Advisor

how to view the current runlevel in hp-ux

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.
20 REPLIES 20
Sajjad Sahir
Honored Contributor
Solution

Re: how to view the current runlevel in hp-ux


Dear Senthil

The command is who -r

thanks and regards

Sajjad Sahir
avizen9
Esteemed Contributor

Re: how to view the current runlevel in hp-ux

hello
you can check the current run level in all hpux flavour with
who -r

also check man who will get more detail help, thanks,
Jeeshan
Honored Contributor

Re: how to view the current runlevel in hp-ux

who -r or runlevel command
a warrior never quits
R.K. #
Honored Contributor

Re: how to view the current runlevel in hp-ux

Hello Senthil,

You can get the runlevel by "who -r" command as shown:

root> who -r
. run-level 3 May 22 17:22 3 0 2

Here the server is in runlevel 3

-r Indicates the current run-level of the init process. The last three fields contain the current state of init, the number of times that state has been previously entered, and the previous state. These fields are updated each time init changes to a different run state.

Regds,
R.K.
Don't fix what ain't broke
Johnson Punniyalingam
Honored Contributor

Re: how to view the current runlevel in hp-ux

Hi,

# who -r ==> will show you current runlevel of hpux.

Thanks,
Johnson
Problems are common to all, but attitude makes the difference
James R. Ferguson
Acclaimed Contributor

Re: how to view the current runlevel in hp-ux

Hi:

Does anyone READ what has already been posted? Endlessly repeating the same answer adds NOTHING!

NO POINTS FOR THIS COMMENT.

...JRF...
johnsonpk
Honored Contributor

Re: how to view the current runlevel in hp-ux

I agree with James..

Repeating the same answer by different user (for sake of adding points to own account)will add NO VALUES to this forum rather makes it quite boring to read...

Thanks!!
Johnson
Dennis Handly
Acclaimed Contributor

Re: how to view the current runlevel in hp-ux

>I want to know current runlevel of HP-UX.

Why do you need it? Is is for some rc(1m) script?

>JRF: Does anyone READ what has already been posted?

It's not enough to read the man page and the current thread. You need to read other threads and you'll find out that "who -r" doesn't work at all.
The result of who(1) is nearly the same as "echo 3".

There was mention of getrunlvl but that may not work either:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1325385
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1239710
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1238202
Kranti Mahmud
Honored Contributor

Re: how to view the current runlevel in hp-ux

Hi Senthil,

who -r gives current run level
/etc/inittab

Hp-UX has the following Run levels:
s single user
2 multi-user; no NFS server capabilities
3 multi-user with NFS server
4 same as 3, but with HP VUE

To change runlevels:
/sbin/shutdown -y 0 # to go to single user state
/sbin/init # bring the system up in the new runlevel

Rgds-Kranti
Dont look BACK as U will miss something INFRONT!
Mark J. Sewhuk
Advisor

Re: how to view the current runlevel in hp-ux

Commands who -r and getrunlvl will return the run level of init. IF you are fully booting a system up by not interupting boot at ISL/EFI the return will always be a 3 (or what ever is defined in /etc/inittab. If you bring a system down to level 1 or 2 or S
these commands will show that run level.

It is a bit strange but when the rc1.d and rc2.d scripts are executed they are techincally running at run level 3. If you want to know what stage of startup a system is at I have used the following logic in the rc scripts


RUN_LEVEL=$(echo $0 | awk -F/ '{print $3}')

This should return the directory the script is running from .



Kranti Mahmud
Honored Contributor

Re: how to view the current runlevel in hp-ux

Hi Senthil,

who -r will show you the current run levels of HP-UX. HPUX has the following run levels:

0--System halted
S--Single-User mode, booted to system console only, with only root filesystem mounted (as read-only)
s--Single-User mode, identical to S except the current terminal acts as the system console
1--Single-User mode with local filesystems mounted (read-write)
2--Multi-User mode with most daemons started and Common Desktop Environment launched
3--Identical to runlevel 2 with NFS exported
4--Multi-User mode with VUE started instead of CDE
5, 6--Not used/User-definable

Rgds-Kranti
Dont look BACK as U will miss something INFRONT!
Dennis Handly
Acclaimed Contributor

Re: how to view the current runlevel in hp-ux

>Kranti: who -r will show you the current run levels of HP-UX.

Again I suggest you read all the replies so you know that "who -r" is broken and doesn't work.
F Verschuren
Esteemed Contributor

Re: how to view the current runlevel in hp-ux

runlevels are not inported, I can stop everyting till runlevel 1 whitout changing the runlevel.

if the stop start scripts are used you can check the /etc/rc.log and the old log.
the last entery is the last this that is stopped/started.
don't worry about the run level, yust see what processes/deamons are running...

why:
if you stop everyting till run level 2, it will not look the same as you start everyting untill level 2, why, yous stop scrips will not stop everyting...
Hakki Aydin Ucar
Honored Contributor

Re: how to view the current runlevel in hp-ux

>Dennis:Again I suggest you read all the replies so you know that "who -r" is broken and doesn't work.

So do you mean, who -r is not a guaranteed command to know, it is not dynamic response , because it just read from file and if it files is not guaranteed situation when it read.
Dennis Handly
Acclaimed Contributor

Re: how to view the current runlevel in hp-ux

>Hakki: So do you mean, who -r is not a guaranteed command to know, it is not dynamic response, because it just read from file

See links above. It reads it from utmp(4) and that only has a value if 3 or larger. It may have smaller values if you use init(1m) to reduce the run level.
Jerry Jiangwei
Advisor

Re: how to view the current runlevel in hp-ux

Try with command - getrunlvl

bash-4.0# getrunlvl
New_level 3 Old_level S
Hakki Aydin Ucar
Honored Contributor

Re: how to view the current runlevel in hp-ux

>Jerry: getrunlvl

Check this link out for getrunlvl ,you can see what Dennis exactly want to say;

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=217851&admit=109447626+1257761270117+28353475
Pete Randall
Outstanding Contributor

Re: how to view the current runlevel in hp-ux

JRF:

> Does anyone READ what has already been posted? Endlessly repeating the same answer adds NOTHING!


They must read it, Jim. These morons wouldn't know the answer otherwise!


Pete

Pete
Suraj K Sankari
Honored Contributor

Re: how to view the current runlevel in hp-ux

JRF:

> Does anyone READ what has already been posted? Endlessly repeating the same answer adds NOTHING!

That is the reasion I told to Senthil please close the thread once he got the correct answer.

Suraj
senthil_kumar_2
Regular Advisor

Re: how to view the current runlevel in hp-ux

I am closing this thread.