Operating System - HP-UX
1833046 Members
2378 Online
110049 Solutions
New Discussion

How do I run programs at boot time?

 
Alexander_101
Advisor

How do I run programs at boot time?

HI all,

i'm new to HP-UX11i, and i need to run some programs automaticaly at boottime,
what should i do ? where to do it ??
8 REPLIES 8
A. Clay Stephenson
Acclaimed Contributor

Re: How do I run programs at boot time?

Look in /sbin/init.d. There is a template file there. Copy it and adapt it to your needs.

Let's suppose that your script is called 'doit' and that it need to start in run level 3 and stop in run level 2.

You would create the symbolic links
ln -s /sbin/init.d/doit /sbin/rc3.d/S900doit
ln -s /sbin/init.d/doit /sbin/rc2.d/K100doit

By convent the Sxxx and Kyyy values should sum to 1000 because that tends to correctly order the startup and stop routines.

Man rc for details.
If it ain't broke, I can fix that.
H.Merijn Brand (procura
Honored Contributor

Re: How do I run programs at boot time?

It's just a little bit more complicated than you state it.

You determine the runlevel at which the process should run. If that doesn't matter, use /etc/rc.local and add this line to /etc/inittab:

lcl:3456:once:/etc/rc.local

/etc/rc.locat will than be executed only once when init level 3, 4, 5, or 6 is entered. Just include the levels there you need.

If the sequence is important (depends on what parts of the boot process is done, and which part not (yet), you have to go dig in /sbin/init.d and /sbin/rc#.d (where # is the runlevel you want to influence

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Pete Randall
Outstanding Contributor

Re: How do I run programs at boot time?

RAC_1
Honored Contributor

Re: How do I run programs at boot time?

You need to put it in /sbin/init.d and then create run links and stop links. The links will be put in rc dirs depending upon which run level you want it to start.

Refer /sbin/init.d/template file.
There is no substitute to HARDWORK
A. Clay Stephenson
Acclaimed Contributor

Re: How do I run programs at boot time?

Plan B (and not suggested): You can also create an entry in /etc/inittab.
If it ain't broke, I can fix that.
H.Merijn Brand (procura
Honored Contributor

Re: How do I run programs at boot time?

A.Clay. please re-read my post. That was my plan A.

Simple, effective, and efficient

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Dave La Mar
Honored Contributor

Re: How do I run programs at boot time?

Attached find the HP doc we use for this which includes a function to test.

All input so far should get you the desired results.

Best of luck.

Regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Alexander_101
Advisor

Re: How do I run programs at boot time?

Ok, thanks ALL !!