bootup script

Hello there
I need to run a script whenever i reboot or startup my HP-UX server. This script adds some routes to the route table, and it start third party aplications like "Star Manager".
I thought i could do this simply putting the script in "/sbin/init.d,
and a link to the script in "/sbin/rc2.d" using this command:

ls -s /sbin/init.d/myscript S999myscript

Then i have created a reference to "/etc/rc.config.d/myscript"
using in the file , "MYSCRIPT=1", wich means it's to run.

But, simply just doesn't work.
What am i doing rong?
Thanks for any help

ls -s /sbin/init.d/myscript  S999myscript

The correct command is ln -s, not ls -s.

Also, you should link the script as S99myscript, i.e. only TWO digits. Apart from that, I'm a Linux admin so I don't know the specifics of HP-UX, but under Linux:

place original file in /etc/rc.d, then create the link thusly

ln -s /etc/rc.d/myscript /etc/rc.d/rc3.d/S99myscript

(or rcn.d where n is the runlevel)

Don't know if this helps

Cheers
ZB

> Also, you should link the script as S99myscript, i.e. only TWO > > digits.

HP-UX uses mostly 3 digits after the S or K. Thus S999 would
be the last thing started.

Note - good practice says you should also create an equivalant stop script i.e. K999myscript or similar.

  • Finnbarr

Sorry , i have used "ln -s" not "ls -s", i just wrote it wrong.
Like you said fpmurphy, HP-UX uses 3 digits to set the starting order, so i have used S999 to star in last.
I will create the other link with K100 to kill the process, thats a very good tip. But first of all, i want to get it started.
many thanks to you both.

It sounds like you're doing things more or less right. Look in /etc/rc.log to see if there are any clues there.

I love this forum
Thanks Perderabo, you were right.
I looked into rc.log , and found a "/sbin/rc2.d/S999myscript: execute permission denied
start FAILED

I dont know why it doesn't start but this is a point to go from.
By the way, could this have something to do with the run level?
or could be about permissions, wich would be strange since the script was created by "root"?

You'll need to make sure that the original file, /sbin/init.d/myscript, has execute permission.

chmod 755 /sbin/init.d/myscript

would make it executable for the scripts owner, and everyone else

the check that the permissions exist for the link with

ls -l /sbin/rc2.d/S999myscript

and it should be something like lrwxr-xr-x Use the other scripts for a guide as to what the permissions should be.

thanks Zazzybob.
You were right, i have changed de permissions and all worked fine.
Once again, thank you all