Professional Web Applications Themes

Querying run level - Linux / Unix Administration

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

  1. #1

    Default Querying run level

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


    Thanks.
    Mister Guest

  2. #2

    Default Re: Querying run level

    net (Mister Anon) writes:
     

    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 !!!
    Dragan Guest

  3. #3

    Default Re: Querying run level

    net (Mister Anon) writes:
     

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

    Uli

    --
    '''
    (0 0)
    +------oOO----(_)--------------+
    | |
    | Ulrich Herbst |
    | |
    | de |
    +-------------------oOO--------+
    |__|__|
    || ||
    ooO Ooo
    Ulrich Guest

  4. #4

    Default Re: Querying run level

    Mister Anon wrote:
     

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

  5. #5

    Default Re: Querying run level

    matt_left_coast <org> writes:
     
    >
    > I don't know what OS you are using, but with Mandrake Linux there is
    > "runlevel" or "who -r" in solaris.[/ref]

    "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 !!!
    Dragan Guest

  6. #6

    Default Re: Querying run level

    Ulrich Herbst <de> writes: 
    >
    > Try "ps -ef | grep init".
    > on some (most ?) systems, the runlevel is written like
    > init [2][/ref]

    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.

    --
    Keith Thompson (The_Other_Keith) org <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
    Keith Guest

  7. #7

    Default Re: Querying run level

    Keith Thompson <org> writes:
     
    > >
    > > Try "ps -ef | grep init".
    > > on some (most ?) systems, the runlevel is written like
    > > init [2][/ref]
    >
    > 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.
    >[/ref]
    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 |
    | |
    | de |
    +-------------------oOO--------+
    |__|__|
    || ||
    ooO Ooo
    Ulrich Guest

  8. #8

    Default Re: Querying run level

    Ulrich Herbst <de> writes:
     [/ref][/ref]
     
    >>
    >> 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.
    >>[/ref]
    > OK,
    > "ps -ef | grep init" does work on:
    > RH9: yes[/ref]

    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
     

    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 !!!
    Dragan Guest

Similar Threads

  1. Question querying 2 queries
    By pumu in forum ColdFusion
    Replies: 2
    Last Post: November 14th, 05:26 AM
  2. Control Level 0 MC from Level 1 Button?
    By Jack in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: February 10th, 08:59 PM
  3. Control Level 0 MC from Level 1 Button?
    By haydenad in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: February 10th, 08:42 PM
  4. Replies: 2
    Last Post: August 18th, 11:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139