Query init runlevel?

Query init runlevel?

am 09.04.2008 18:09:13 von Steven Woody

I forgot what command which can tell me current init runlevel value.
Thanks.

Re: Query init runlevel?

am 09.04.2008 18:22:59 von Michael Tosch

Steven Woody wrote:
> I forgot what command which can tell me current init runlevel value.
> Thanks.

who -r


--
Michael Tosch @ hp : com

Re: Query init runlevel?

am 09.04.2008 18:30:20 von Bill Marcum

On 2008-04-09, Steven Woody wrote:
>
>
> I forgot what command which can tell me current init runlevel value.
> Thanks.

runlevel ?

Re: Query init runlevel?

am 09.04.2008 18:44:13 von cfajohnson

On 2008-04-09, Steven Woody wrote:
> On Apr 10, 12:30 am, Bill Marcum wrote:
>> On 2008-04-09, Steven Woody wrote:
>>
>>
>>
>> > I forgot what command which can tell me current init runlevel value.
>> > Thanks.
>>
>> runlevel ?
>
> Good! Thank you!
>
> The runlevel prints:
> N 3
> From the runlevel's man page, I got N means the previous runlevel is
> not exist. I can not understand this. I guess, there is at least one
> runlevel prior to level 3, such as 0. Why `runlevel' just tell me `N'?

If you haven't changed the runlevel since booting, there is no
previous runlevel and it will print N.

--
Chris F.A. Johnson, author
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence

Re: Query init runlevel?

am 09.04.2008 18:52:52 von PK

Steven Woody wrote:

> I forgot what command which can tell me current init runlevel value.
> Thanks.

Did you try "runlevel"?
Under linux it's usually available.

--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.

Re: Query init runlevel?

am 09.04.2008 18:54:08 von Steven Woody

On Apr 10, 12:30 am, Bill Marcum wrote:
> On 2008-04-09, Steven Woody wrote:
>
>
>
> > I forgot what command which can tell me current init runlevel value.
> > Thanks.
>
> runlevel ?

Good! Thank you!

The runlevel prints:
N 3
From the runlevel's man page, I got N means the previous runlevel is
not exist. I can not understand this. I guess, there is at least one
runlevel prior to level 3, such as 0. Why `runlevel' just tell me `N'?

Re: Query init runlevel?

am 10.04.2008 01:10:31 von Kaz Kylheku

On Apr 9, 9:52=A0am, pk wrote:
> Steven Woody wrote:
> > I forgot what command which can tell me current init runlevel value.
> > Thanks.
>
> Did you try "runlevel"?
> Under linux it's usually available.

This is a part of sysvinit. Any distribution that uses sysvinit (and
hasn't messed up the packaging) should have this program in /sbin.

Re: Query init runlevel?

am 10.04.2008 02:14:56 von wayne

Kaz Kylheku wrote:
> On Apr 9, 9:52 am, pk wrote:
>> Steven Woody wrote:
>>> I forgot what command which can tell me current init runlevel value.
>>> Thanks.
>> Did you try "runlevel"?
>> Under linux it's usually available.
>
> This is a part of sysvinit. Any distribution that uses sysvinit (and
> hasn't messed up the packaging) should have this program in /sbin.

True, but all Unix systems have the who command, so "who -r" is
the more portable solution. (For example Solaris 10 doesn't
use SysV init.)

-Wayne

Re: Query init runlevel?

am 10.04.2008 04:06:27 von Maxwell Lol

"Chris F.A. Johnson" writes:

> > The runlevel prints:
> > N 3
> > From the runlevel's man page, I got N means the previous runlevel is
> > not exist. I can not understand this. I guess, there is at least one
> > runlevel prior to level 3, such as 0. Why `runlevel' just tell me `N'?
>
> If you haven't changed the runlevel since booting, there is no
> previous runlevel and it will print N.

As I recall, some systems go from runlevel S to 2 to 3 at boot. I
suppose looking at /etc/inittab might help.

Re: Query init runlevel?

am 10.04.2008 09:40:30 von gerg

Maxwell Lol writes:
>"Chris F.A. Johnson" writes:
>
>> > The runlevel prints:
>> > N 3
>> > From the runlevel's man page, I got N means the previous runlevel is
>> > not exist. I can not understand this. I guess, there is at least one
>> > runlevel prior to level 3, such as 0. Why `runlevel' just tell me `N'?
>>
>> If you haven't changed the runlevel since booting, there is no
>> previous runlevel and it will print N.
>
>As I recall, some systems go from runlevel S to 2 to 3 at boot. I
>suppose looking at /etc/inittab might help.
>

That's not really what happens. The inittab file may cause the
scripts defined for the S level to be invoked, followed by the
ones for the 2 level, followed by the ones for the 3 level.
(Solaris 9 and earlier does this, for example)

However, that is an effect of the way the entries in the inittab
file are written. It is not a result of init moving through those
levels in that sequence.

-Greg
--
::::::::::::: Greg Andrews ::::: gerg@panix.com :::::::::::::
I have a map of the United States that's actual size.
-- Steven Wright

Re: Query init runlevel?

am 10.04.2008 21:57:08 von Chris Mattern

On 2008-04-10, Wayne wrote:
> Kaz Kylheku wrote:
>> On Apr 9, 9:52 am, pk wrote:
>>> Steven Woody wrote:
>>>> I forgot what command which can tell me current init runlevel value.
>>>> Thanks.
>>> Did you try "runlevel"?
>>> Under linux it's usually available.
>>
>> This is a part of sysvinit. Any distribution that uses sysvinit (and
>> hasn't messed up the packaging) should have this program in /sbin.
>
> True, but all Unix systems have the who command, so "who -r" is
> the more portable solution. (For example Solaris 10 doesn't
> use SysV init.)
>
Yes, it does, it's just moved most of the functionality into svcs.
Your rc directories and /etc/init.d are still there and operational.
They're mostly empty, but they're still there. I will admit, it
doesn't seem to have an /sbin/runlevel, but then, neither does
Solaris 9 (which uses only SysV init). runlevel appears to be a
linuxism. who -r is probably more portable, as you say.


--
Christopher Mattern

NOTICE
Thank you for noticing this new notice
Your noticing it has been noted
And will be reported to the authorities