Running Level

Running Level

Post by Chri » Wed, 23 Oct 2002 17:38:27



Hi all,

Running with Solaris 8 on E450.
I made a script which is called S73NfsChoice in the directory /etc/rc2.d.
In this script I detect the run-level of the system. Normally , I can't
launch my script if the run-level is different than 2.
The things is that when my script is running, the run-level is 3 and not 2
....
I don't understand because my script is placed in the /etc/rc2.d directory
?????

My question is the following : in the /etc/rc2.d directory, when does the
run-level is 2 and then 3 ????

Thanks,

Chris.

 
 
 

Running Level

Post by Chri » Wed, 23 Oct 2002 18:57:07


Quote:> You are aware that scripts in /etc/init.d are HARD links to scripts in
> /etc/rcN.d/Snn<script>, right?  IIRC, NFS server is started in
> /etc/rc3.d but it also could be in /etc/rc2.d/.

> Does your script have EXECUTE privs, owned by root, and named SNN<script>
> where NN is a number between 00 and 99?  This is how SYSV does startup
> scripts.

> --
> DeeDee, don't press that button!  DeeDee!  NO!  Dee...

My script is situated under /etc/rc2.d directory like that :

lrwxrwxrwx    1    root    other    27    Jul    10    11:02
   S73NfsChoice -> /etc/init.d/NfsChoice

In my script, I've got :

_effect_level_=`who -r | $AWK '{ print $3 }'`
echo Run Level $_effect_level

When the script starts I've got : Run Level 3 instead of 2 ????
So what's wrong ???

Thanks.

Chris.

 
 
 

Running Level

Post by Nigel Mello » Wed, 23 Oct 2002 19:13:47


runlevel 2 scripts will also be executed at runlevel 3. This is why your
script in rc2.d is being invoked at runlevel 3.

Normally you would place the init script in /etc/init.d and create a
(symbolic) link to the script in the appropriate runlevel directory
(/etc/rc?.d).

e.g. # ln -s /etc/init.d/nfschoice /etc/rc2.d/S73nfschoice

--
Nigel Mellor


Quote:> Hi all,

> Running with Solaris 8 on E450.
> I made a script which is called S73NfsChoice in the directory /etc/rc2.d.
> In this script I detect the run-level of the system. Normally , I can't
> launch my script if the run-level is different than 2.
> The things is that when my script is running, the run-level is 3 and not 2
> ....
> I don't understand because my script is placed in the /etc/rc2.d directory
> ?????

> My question is the following : in the /etc/rc2.d directory, when does the
> run-level is 2 and then 3 ????

> Thanks,

> Chris.

 
 
 

Running Level

Post by Chri » Thu, 24 Oct 2002 01:34:31



> runlevel 2 scripts will also be executed at runlevel 3. This is why your
> script in rc2.d is being invoked at runlevel 3.

> Normally you would place the init script in /etc/init.d and create a
> (symbolic) link to the script in the appropriate runlevel directory
> (/etc/rc?.d).

> e.g. # ln -s /etc/init.d/nfschoice /etc/rc2.d/S73nfschoice

> --
> Nigel Mellor


I understand.
So my question will be :

Is it possible to create an rc script which will be only call during
run-level 2 ???

Thanks,

Chris.

 
 
 

Running Level

Post by Bertrand Zidle » Thu, 24 Oct 2002 02:23:40



> So my question will be :

> Is it possible to create an rc script which will be only call during
> run-level 2 ???

> Thanks,

> Chris.

May be you can change your test : if it is run level 3 then exit
--
Bertrand
 
 
 

Running Level

Post by Greg Andre » Thu, 24 Oct 2002 04:29:05



>Running with Solaris 8 on E450.
>I made a script which is called S73NfsChoice in the directory /etc/rc2.d.
>In this script I detect the run-level of the system. Normally , I can't
>launch my script if the run-level is different than 2.
>The things is that when my script is running, the run-level is 3 and not 2
>....
>I don't understand because my script is placed in the /etc/rc2.d directory
>?????

>My question is the following : in the /etc/rc2.d directory, when does the
>run-level is 2 and then 3 ????

You have a misunderstanding of how Solaris booting works.  Take a look
at the Solaris /etc/inittab.  Among the other lines you'll see these
three:

    is:3:initdefault:
    .
    .
    s2:23:wait:/sbin/rc2      >/dev/msglog 2<>/dev/msglog </dev/console
    s3:3:wait:/sbin/rc3      >/dev/msglog 2<>/dev/msglog </dev/console

The initdefault line tells init that the default run level to boot
into is run level 3.

The s2 line says the /sbin/rc2 script should be invoked when switching
to both run level 2 and run level 3.  The s3 line says the /sbion/rc3
script should be invoked when switching to run level 3.  Since the s2
line comes before the s3 line, the /sbin/rc2 script will be invoked
before the /sbin/rc3 script.  Since the third field in the s2 line is
"wait", init will wait until the /sbin/rc2 script is finished before
invoking the /sbin/rc3 script.

So the /sbin/rc2 script, and therefore the K and S scripts in the rc2.d
directory, will be invoked when Solaris is booting into run level 2 or
run level 3.  Not just when Solaris is booting into run level 2.

So ask yourself what your script does, and choose an appropriate place
in the sequence of rc2.d and rc3.d scripts to invoke it.

  -Greg
--
Do NOT reply via e-mail.
Reply in the newsgroup.

 
 
 

Running Level

Post by Joseph Walte » Fri, 25 Oct 2002 09:46:46



> runlevel 2 scripts will also be executed at runlevel 3. This is why your
> script in rc2.d is being invoked at runlevel 3.

> Normally you would place the init script in /etc/init.d and create a
> (symbolic) link to the script in the appropriate runlevel directory
> (/etc/rc?.d).

> e.g. # ln -s /etc/init.d/nfschoice /etc/rc2.d/S73nfschoice

> --
> Nigel Mellor


Actually, they should always be hard links, not soft.
 
 
 

Running Level

Post by Paul Robertso » Fri, 25 Oct 2002 10:12:41




> Actually, they should always be hard links, not soft.

Why? What's the advantage of a hard link in this case?

--
Paul Robertson

 
 
 

Running Level

Post by Nigel Mello » Fri, 25 Oct 2002 17:45:31



Quote:> Actually, they should always be hard links, not soft.

Please qualify this.

Soft links have always worked fine for me on Solaris and Linux. IMHO it also
makes the init sequence easier to understand and maintain.

Nigel.

 
 
 

1. run level script

Hi,

I have a program that I would like to run at the start of the system at run
level 1, 3 and 5. I was told that I need to make a rc script. Would someone
kindly give me a few pointers on how to do this? A simple example is much
appreciated.

Regards,
Norman

2. Terminal setup

3. ENTER RUN LEVEL ?!

4. how to access network card..

5. What are all these daemons in run level?

6. Mouse will not work with dosemu 0.49

7. "Not enough processes in this run level"?

8. Comma delimited file

9. Run level 5

10. Unable to log on the second time using run level 5

11. oops, wrong run level

12. run level testing

13. linux run level