Operating System - HP-UX
1752586 Members
4342 Online
108788 Solutions
New Discussion юеВ

script/command execution at booting

 
shashi kanth
Super Advisor

script/command execution at booting

I have script/command and i want this script/command needs to be invoked at HP-UX booting (everytime when HP-UX boots).


In which file i can put the command/script in HP-UX ?

6 REPLIES 6
Torsten.
Acclaimed Contributor

Re: script/command execution at booting

Please see

http://www.docs.hp.com/en/934/startup.pdf

unchanged since hp-ux 10.x

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Shahul
Esteemed Contributor

Re: script/command execution at booting

Hi,

Copy your script to /sbin/init.d/ directory and set execute permission. Then create symbolic link in the appropriate run level RC directory to this script. For eg. the script name is "myscript.sh" and I want that to run on run level 3. Then I would do the following.

#cp myscript.sh /sbin/init.d
#chmod 755 /sbin/init.d/myscript.sh
#cd /sbin/rc3.d
#ln -s /sbin/init.d/myscript.sh S101myscript.sh (the number 101 is the sequence number, you can change it any number).
#cd /sbin/r2.d
#ln -s /sbin/init.d/myscript.sh K899myscript.sh (the number 899 is the sequence number, you can change it to any number).

remember to test your script before adding to these directories, else your system may not boot correctly.

Good luck
Shahul
Mark McDonald_2
Trusted Contributor

Re: script/command execution at booting

You could also check how the inittab file works, this can be handy for things that need to be running from boot time.
James R. Ferguson
Acclaimed Contributor

Re: script/command execution at booting

Hi:

The whitepaper Torsten cited is probably the best discussion. You can also see a virtual summary in the manpages for 'rc(1M)'. You will note from those manpages that a return code of <4> and greater is defined. This was not described in the original paper.

Regards!

...JRF...
Tingli
Esteemed Contributor

Re: script/command execution at booting

Two more things.

1. You can prepare a file under /etc/rc.config.d/ to switch on and off the start up scripts.

2. The K and S number should have the sum of 1000. So if the start up file is S911 then the shutdown number should be K089.
Laurent Menase
Honored Contributor

Re: script/command execution at booting

Just a remark
don't use or don't start application which are using socket/netstat before
/sbin/rc2.d/S008net.init