Operating System - HP-UX
1834771 Members
3224 Online
110070 Solutions
New Discussion

Re: Adding a program to run during Boot time

 
Aggy
Frequent Advisor

Adding a program to run during Boot time

I have a Script which I want to run during Startup.
I had copied the Script in /sbin/init.d and also created a link in /sbin/rc3.d using ln -s command.
But it does not run.
Do I have to go through any other steps do that the script runs duting the bootup.


6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: Adding a program to run during Boot time

Hi:

Check the /etc/rc.log for any information about your script. Make sure that your script uses the Posix shell and declares its intention with "#!/sbin/sh" and not "#!/usr/..." although /usr should be mounted by this point. Make sure that /etc/inittab has your default runlevel set to '3' -- the first line should be "init:3:initdefault:". You should also have a link in /sbin/rc2.d for a kill.

An excellent white paper fully describing all requirements is the "HP-UX 10.x Startup and Configuration (HP-UX 10.x)" found in PDF format at:

http://docs.hp.com/hpux/os/10.x/index.html

...JRF...
Aggy
Frequent Advisor

Re: Adding a program to run during Boot time

Thank U. James But my Script is fine and working in one system.When I try to copy it to other and then link it to rc2.d for kill and rc3.d for start, it does not run.And gives no output for S100mfg in rc2.d and K100mfg in rc3.d in /etc/rc.log.
melvyn burnard
Honored Contributor

Re: Adding a program to run during Boot time

Do you have an entry in /etc/rc.config.d to tell the rc utiliities to run it or skip it?

This directory is checked and all the files read in to set up variables that are then acted upon, indicating in the simplest instance whether to skip or start a particulasr rc script.
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Jitendra_1
Trusted Contributor

Re: Adding a program to run during Boot time

Did you tried it running manually from the command prompt to see if it gives any errors. may be some environment variables which it expects are not available at boot time.
Learning is the Key!
Shannon Petry
Honored Contributor

Re: Adding a program to run during Boot time

Another thing to look at is does your script use a case to process how it is called?
I.E.
case $1 in
start)
;;
stop)
;;
esac

I usually add the "start_msg" and "stop_msg" as well to the boot scripts so that I can see if they are starting....

Another smaller point is does the link number overlap with another?
> ls /sbin/rc3.d
S990dtlogin.rc S990myscript.rc

I have seen where one of these scripts do not start up because of this.

Regards,
Shannon
Microsoft. When do you want a virus today?
Rick Garland
Honored Contributor

Re: Adding a program to run during Boot time

I have been dealing with something similar as well.
You can put echo statements in the script as a troubleshooting tool. Also, check on the the return status (echo "$?"). Try to place the set -x in the beginning of the script as well so you can follow its steps. Redirect all to a log file somewhere where you can view the outputs.

These are only aids to help find the culprit. I would also check the documents concerning the start/stop boot process as well.