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

Startup my own program in init.d directory

 
SOLVED
Go to solution
Achilles_2
Regular Advisor

Startup my own program in init.d directory

HI all,

I put my own program in /sbin/init.d/ so that it could start up automatically when the server reboot. But it failed to start.

What is the step of setup correctly to start up? The model is HP A500 with 11.00.

Thx
Alex
16 REPLIES 16
Robert-Jan Goossens
Honored Contributor

Re: Startup my own program in init.d directory

Hi Alex,

Did you create a link in the /sbin/rc3.d ?

example below.

:/sbin/init.d# ls -la lis*
-r-xr-xr-x 1 bin bin 3249 Jun 22 2000 listener

Start script

# ls -la /sbin/rc3.d | grep lis
lrwxrwxrwx 1 root sys 21 Jun 22 2000 S950listener.rc -> /sbin/init.d/listener

Kill script

# ls -la /sbin/rc2.d | grep lis
lrwxrwxrwx 1 root sys 21 Jun 22 2000 K050listener.rc -> /sbin/init.d/listener

HTH,
Robert-Jan
Johan Lorimier
Frequent Advisor

Re: Startup my own program in init.d directory

Hi,

Have you done the link in the rc3d directory ?

for example, the link must have this syntax :
S999program -> ../init.d/program
for the startup and,
K999program -> ../init.d/program for the stop.

The number is use to give the order in the statup/shutdown sequence.

Johan
G. Vrijhoeven
Honored Contributor

Re: Startup my own program in init.d directory

Hi Alex,

If you want the script to be executed during startup you need to create a symbilic link to it from /etc/rc3.d ( run level 3) staring with a Kapital S folowed by a number ( start order) Ss

cd /sbin/rc3.d
ln -s /sbin/init.d/ S
and to stop it when the server halts do the same, just replace the S (start) with a K (kill) folowed by a number and a name. Make sure the number is the opposite of the start number. ( e.g. S99 = K01 ....)

Regards,

Gideon
G. Vrijhoeven
Honored Contributor

Re: Startup my own program in init.d directory

Hi again Alex,

Made an error in prev. post.
The ln -s soure destionation, so it is the opposite.

Regards,

Gideon
Fabio Ettore
Honored Contributor

Re: Startup my own program in init.d directory

Hi Alex,

check the following doc:

A3937045 - SYS ADM: Adding a custom script to rc process

HTH.

Best regards,
Ettore
WISH? IMPROVEMENT!
Achilles_2
Regular Advisor

Re: Startup my own program in init.d directory

Is the name of doc. called "A3937045 - SYS ADM: Adding a custom script to rc process"
correct? I can't get it.
Fabio Ettore
Honored Contributor

Re: Startup my own program in init.d directory

Alex,

have you a support contract with HP?

Only with that you can see knowledge base of ITRC.

Anyway can you past the procedure that you used to create your rc script?

Best regards,
Ettore
WISH? IMPROVEMENT!
Achilles_2
Regular Advisor

Re: Startup my own program in init.d directory

It can't work and also try to creat a link in /sbin/rc3.d/ directory, but it can't startup.
Robert-Jan Goossens
Honored Contributor

Re: Startup my own program in init.d directory

Alex,

could you post

# ls -la /sbin/rc3.d/your_start_link

# ls -la /sbin/rc2.d/your_kill_link

# ls -la /sbin/init.d/your_script

Regards,
Robert-Jan
Achilles_2
Regular Advisor

Re: Startup my own program in init.d directory

Hi Robert-Jan

Here are my created link and my script:

/sbin/init.d # ls -l
-rwxrwxrwx 1 root sys 73 May 10 18:02 rund
-rwxrwxr-x 1 root sys 6132 May 10 18:02 rsic.conf.henry

/sbin/rc3.d # ls -l
lrwxrwxrwx 1 root sys 17 Oct 15 18:11 S666rsi -> /sbin/init.d/rund

Alex
Bart Paulusse
Respected Contributor
Solution

Re: Startup my own program in init.d directory

Hi Alex,

the rsic.conf.henry file, is that a config file for your script?
If so, is the path to that config file given?
If not, the ling in the /sbin/rc3.d/ directory cannot find it.

Have you tried starting your script by starting the link in /sbin/rc3.d (not during startup, but while the system is up)
This might result in an error which might help you solving this problem.


Don't forget to assigng points to all those people trying to help you...

regards,

Bart

Mark Ellzey
Valued Contributor

Re: Startup my own program in init.d directory

Alex,

Make sure you have the PATH variable in your script set so that all executables within your script are accessable. The default PATH variable is restricted.

Regards,
Mark
Geoff Wild
Honored Contributor

Re: Startup my own program in init.d directory

Can you post your rund script?

I've attached an example...

Also, do a man rc

Also - what's your default run level?

grep initdefault /etc/inittab

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
R. Allan Hicks
Trusted Contributor

Re: Startup my own program in init.d directory

Also, remember that your script will be called twice.


Try running your rund script by hand as root.

rund start_msg

and

rund start


some snipets from oracle's start file


case $1 in
'start_msg')
# Emit a _short_ message relating to running this script with
# the "start" argument; this message appears as part of the checklist.
echo "Starting Oracle"
;;

'start')

# source the system configuration variables
if [ -f /etc/rc.config.d/oracle ] ; then
. /etc/rc.config.d/oracle
else
echo "ERROR: /etc/rc.config.d/oracle defaults file MISSING"
fi

#rting Oracle"
Check to see if this script is allowed to run...
if [ ${ORACLE_START} != 1 ]; then
rval=2
else

su - oracle -c dbstart
:
fi
;;

Running it by hand as root might give you a clue as to what the script is upset about.
"Only he who attempts the absurd is capable of achieving the impossible
Achilles_2
Regular Advisor

Re: Startup my own program in init.d directory

Thanks a lot for your help
I have solved it out

Cheers
Alex