System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

how to view the current runlevel in hp-ux

 
SOLVED
Go to solution
Highlighted

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 .



Highlighted
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!
Highlighted

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.
Highlighted
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...
Highlighted
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.
Highlighted

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.
Highlighted

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

Try with command - getrunlvl

bash-4.0# getrunlvl
New_level 3 Old_level S
Highlighted
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
Highlighted
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
Highlighted
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