Querying run level
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix administration > Querying run level




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Querying run level  
Mister Anon


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-03-05 11:00 PM

Is it possible for a program or a shell script to query from the
system what runlevel it's in?


Thanks.





[ Post a follow-up to this message ]



    Re: Querying run level  
Dragan Cvetkovic


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-03-05 11:00 PM

themf@graffiti.net (Mister Anon) writes:

> Is it possible for a program or a shell script to query from the
> system what runlevel it's in?
>

Depends. Some systems provide this information in 'who -r', some don't
(e.g. some distributions of Linux).

Dragan

--
Dragan Cvetkovic,

To be or not to be is true. G. Boole      No it isn't.  L. E. J. Brouwer

!!! Sender/From address is bogus. Use reply-to one !!!





[ Post a follow-up to this message ]



    Re: Querying run level  
Ulrich Herbst


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-03-05 11:00 PM

themf@graffiti.net (Mister Anon) writes:

> Is it possible for a program or a shell script to query from the
> system what runlevel it's in?
>
>
> Thanks.

Try "ps -ef | grep init".
on some (most ?) systems, the runlevel is written like
init [2]

Uli

--
'''
(0 0)
+------oOO----(_)--------------+
|                              |
|         Ulrich Herbst        |
|                              |
|      Ulrich.Herbst@gmx.de    |
+-------------------oOO--------+
|__|__|
|| ||
ooO Ooo





[ Post a follow-up to this message ]



    Re: Querying run level  
matt_left_coast


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-03-05 11:00 PM

Mister Anon wrote:

> Is it possible for a program or a shell script to query from the
> system what runlevel it's in?
>
>
> Thanks.

I don't know what OS you are using, but with Mandrake Linux there is
"runlevel" or "who -r" in solaris.





[ Post a follow-up to this message ]



    Re: Querying run level  
Dragan Cvetkovic


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-03-05 11:00 PM

matt_left_coast <Not@given.org> writes:

> Mister Anon wrote:
> 
>
> I don't know what OS you are using, but with Mandrake Linux there is
> "runlevel" or "who -r" in solaris.

"who -r" works also on AIX and most modern Linux distros (old RH based
distros didn't accept who -r and therefore had need for, above mentioned,
runlevel command).

Of course, BSDes don't have 'who -r' as they don't have a concept of run
levels.

Dragan

--
Dragan Cvetkovic,

To be or not to be is true. G. Boole      No it isn't.  L. E. J. Brouwer

!!! Sender/From address is bogus. Use reply-to one !!!





[ Post a follow-up to this message ]



    Re: Querying run level  
Ulrich Herbst


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-05-05 07:51 AM

Keith Thompson <kst-u@mib.org> writes:

> Ulrich Herbst <ulrich.herbst@gmx.de> writes: 
>
> Not on most of the systems I've tried.  I see it on my Fedora Core 2
> system, but not on Red Hat (several versions), Solaris, or AIX.
>
OK,
"ps -ef | grep init" does work on:
RH9: yes
Debian: yes
RH EL4: yes
AIX: no
HP/UX 11: no
Solaris: no
Irix: no

=> "ps -ef | grep init" seems to work on many linux systems, but not
on many commercial unixes.

Uli

--
'''
(0 0)
+------oOO----(_)--------------+
|                              |
|         Ulrich Herbst        |
|                              |
|      Ulrich.Herbst@gmx.de    |
+-------------------oOO--------+
|__|__|
|| ||
ooO Ooo





[ Post a follow-up to this message ]



    Re: Querying run level  
Dragan Cvetkovic


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-05-05 12:49 PM

Ulrich Herbst <ulrich.herbst@gmx.de> writes:

> Keith Thompson <kst-u@mib.org> writes:
> 
[vbcol=seagreen] 
> OK,
> "ps -ef | grep init" does work on:
> RH9: yes

Not on our RH9 system either:

hector$ /bin/ps -fe | grep '[i]'nit
root         1     0  0 Mar30 ?        00:00:04 init
hector$ cat /etc/issue
Red Hat Linux release 9 (Shrike)
Kernel \r on an \m

hector$ uname -r
2.4.20-35_39.rh9.at

> Debian: yes
> RH EL4: yes
> AIX: no
> HP/UX 11: no
> Solaris: no
> Irix: no
>
> => "ps -ef | grep init" seems to work on many linux systems, but not
> on many commercial unixes.

In other words, it works nowhere except on (some) Linux systems :-)

'who -r' is more common.

Dragan

--
Dragan Cvetkovic,

To be or not to be is true. G. Boole      No it isn't.  L. E. J. Brouwer

!!! Sender/From address is bogus. Use reply-to one !!!





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:44 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register