Operating System - HP-UX
1836617 Members
1957 Online
110102 Solutions
New Discussion

Where to put startup script

 
SOLVED
Go to solution
Mike ONeal
Occasional Contributor

Where to put startup script

Hi,

I have a script that I want to add when the system starts to add static routes. It reads a config file which contains the routes. This file is maintained by a non-root person. Will the file be run if it is placed in the /sbin/init.d directory? I tried adding the static routes to /etc/rc.confid.d/netconf file but the addition routes don't get added because /etc/rc.log file says routes where attemped to be added before the interface was up.

Tnx,

Mike

3 REPLIES 3
Kofi ARTHIABAH
Honored Contributor
Solution

Re: Where to put startup script

Mike, your script should run after /sbin/rc2.d/S340net so place the file in /sbin/init.d and create a soft link in the /sbin/rc2.d directory with a name that begins with SXXXyourscript where XXX is greater than 340.

read the information in /usr/share/doc/start_up.txt about startup scripts.

nothing wrong with me that a few lines of code cannot fix!
Bruce Regittko_1
Esteemed Contributor

Re: Where to put startup script

Hi,

/sbin/init.d is the correct place to put the script but you will also have to add a symbolic link (not a hard link) pointing to the script in /sbin/rc2.d.

The symbolic link name is important. It should be in the form SxxxScriptName. The S causes the script to run when the runlevel is entered from a lower runlevel. The xxx is a 3 digit number that indicates when the script should be run relative to the other scripts. Make sure your script is run after the net script has executed. ScriptName will typically match what the script name in /sbin/init.d.

Let me know if this helps or if you need more information.

--Bruce
www.stratech.com/training

Re: Where to put startup script

Hi,
Copy any script from /sbin/init.d and change according to your requirment, after that put your script in /sbin/init.d and /etc/rc.config.d and link ( Symbolic ) into /sbin/rc2.d as S??????. The script name will start with S.

rgds.