1748182 Members
3614 Online
108759 Solutions
New Discussion юеВ

Re: read boot script

 
Tarek_1
Frequent Advisor

read boot script

Hi again,
another small problem.
I have a script that i want to be read while system is booting. I will attach it.
What i'm doing is to put that script under /etc/init.d and then create a link from /etc/rc.d/rc2.d with name S99setKrnlPar that points to the script under /etc/init.d.
Unfortunately this script after boot isn't read.
What i'm missing?
Thanks
Tarek
6 REPLIES 6
Craig Kelley
Valued Contributor

Re: read boot script

Can you manually run the script?

/etc/init.d/setKrnlPar start

Are you running in runlevel 2 by default?

grep initdefault /etc/inittab

id:2:initdefault:

I_M
Honored Contributor

Re: read boot script

Hello

If you want to create RedHat style boot script, you must add following lines, then you will be able to use chkconfig.

# chkconfig : 235 10 90
# description: description of this script

235 is runlevel that the script starts.

10 90 is a priority that the script run & stop.

For the detail, man chkconfig will help you.

Good luck
Tarek_1
Frequent Advisor

Re: read boot script

I'm booting in init mode 3.
I can run the script manually /etc/init.d/setKrnlpar and it works.
Now i will try with chconfig and let you know.
Thanks again
Tarek
Tarek_1
Frequent Advisor

Re: read boot script

I added these to lines in my script:
# chkconfig : 235 10 90
# description: setKrnlPar
Then:
chkconfig --add setKrnlPar
service setKrnlPar does not support chkconfig
But if i issue:
chkconfig setKrnlPar start the script is read
However at boot time no. I don't want that this script should be a service (also because start & stop doesn't have sense here, they aren't used).
I only want that at boot time, this file is read and executed.
Bill Thorsteinson
Honored Contributor

Re: read boot script

Use another script in init.d as a template. It is OK to have stop do nothing.

The script should be executable.
The first line should be indicate the shell to run.
Try '#!/bin/sh -x' to get a debug trace.
Don't count on much of a path or environment.
If you are strarting in run level 3, link in rc3.d not rc2.d. Linux tends not to walk the rc*.d tree during startup. Likely ony rc3.d is being run.
Jeffrey S. Sims
Trusted Contributor

Re: read boot script

Tarek,

Unless you want it to start up at a certain point in the boot process, why wouldn't you just execute the script from /etc/rc.d/rc.local that is run last at boot I believe.

Just a thought. Hope it helps.

Jeff